summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasashi Honma <masashi.honma@gmail.com>2018-03-31 14:23:51 +0900
committerEcco Park <eccopark@google.com>2018-04-09 17:10:52 -0700
commita6bf3d5d91be6913e45408262638d60bbc4cdb5b (patch)
tree08d50c307194c872c5c5f902aacbabc1c9f728b6
parentbd0ca3759ab4cbee1ffaf772702a1b2e783a5952 (diff)
Wifi: Allow Hotspot 2.0 credential without realm matching
The realm node matching is not required when roaming consortium OI exists. Indeed, there is a statement in [1] "2.3 Requirements for Hotspot Operators". "SPs in this situation may find it convenient to be identified by their roaming consortium OI rather than by their realms." [1] Hotspot 2.0 (Release 2) Technical Specification Version 1.0.0 Bug: 77621258 Test: Connect with roaming consortium OI on Nexus 5X with hostapd commit 64624f31cf81dc6164462fa153ee7a5909e21183 "OWE: Fix CONFIG_OWE=y build without CONFIG_IEEE80211R=y". I tested with android-8.1.0_r18 branch and port the patch to master branch because my Nexus 5X does not boot with master branch. Test: All the tests are passed ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I46de90091396d50ec07a91c524074fedf8fd62ff Reported-by: Harada Hiroyuki <infocrafths20@gmail.com> Reported-by: Hideaki Goto <hgot@cc.tohoku.ac.jp> Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
-rw-r--r--service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/ANQPMatcherTest.java24
2 files changed, 29 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java b/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java
index 649534662..a144874b8 100644
--- a/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java
+++ b/service/java/com/android/server/wifi/hotspot2/ANQPMatcher.java
@@ -163,7 +163,7 @@ public class ANQPMatcher {
}
}
- if (realmMatch == AuthMatch.NONE || realmData.getEAPMethods().isEmpty()) {
+ if (realmData.getEAPMethods().isEmpty()) {
return realmMatch;
}
@@ -179,6 +179,10 @@ public class ANQPMatcher {
if (eapMethodMatch == AuthMatch.NONE) {
return AuthMatch.NONE;
}
+
+ if (realmMatch == AuthMatch.NONE) {
+ return eapMethodMatch;
+ }
return realmMatch | eapMethodMatch;
}
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/ANQPMatcherTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/ANQPMatcherTest.java
index a86d6708c..101fe16f6 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/ANQPMatcherTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/ANQPMatcherTest.java
@@ -158,6 +158,30 @@ public class ANQPMatcherTest {
}
/**
+ * Verify that method match will be returned when the specified EAP
+ * method only matches a eap method in the NAI Realm ANQP element.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void matchNAIRealmWithMethodMatch() throws Exception {
+ // Test data.
+ String providerRealm = "test.com";
+ String anqpRealm = "test2.com";
+ int eapMethodID = EAPConstants.EAP_TLS;
+
+ // Setup NAI Realm element.
+ EAPMethod method = new EAPMethod(eapMethodID, new HashMap<Integer, Set<AuthParam>>());
+ NAIRealmData realmData = new NAIRealmData(
+ Arrays.asList(new String[] {anqpRealm}), Arrays.asList(new EAPMethod[] {method}));
+ NAIRealmElement element = new NAIRealmElement(
+ Arrays.asList(new NAIRealmData[] {realmData}));
+
+ assertEquals(AuthMatch.METHOD,
+ ANQPMatcher.matchNAIRealm(element, providerRealm, eapMethodID, null));
+ }
+
+ /**
* Verify that a realm and method match will be returned when the specified realm and EAP
* method matches a realm in the NAI Realm ANQP element.
*