]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Hotspot 2.0 connection based on roaming_consortiums match
authorJouni Malinen <jouni@codeaurora.org>
Tue, 17 Apr 2018 13:40:14 +0000 (16:40 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 17 Apr 2018 14:26:56 +0000 (17:26 +0300)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_ap_hs20.py
tests/hwsim/wpasupplicant.py

index 1dff4d01147b5e61dd258e898796b23d2c2ea99b..a52b958d53267b3a2be1878fe80675e0aa9a5350 100644 (file)
@@ -98,7 +98,7 @@ def check_sp_type(dev, sp_type):
     if type is None:
         raise Exception("sp_type not available")
     if type != sp_type:
-        raise Exception("sp_type did not indicate home network")
+        raise Exception("sp_type did not indicate %s network" % sp_type)
 
 def hlr_auc_gw_available():
     if not os.path.exists("/tmp/hlr_auc_gw.sock"):
@@ -1010,6 +1010,30 @@ def test_ap_hs20_roaming_consortium(dev, apdev):
             raise Exception("Timeout on already-connected event")
         dev[0].remove_cred(id)
 
+def test_ap_hs20_roaming_consortiums_match(dev, apdev):
+    """Hotspot 2.0 connection based on roaming_consortiums match"""
+    bssid = apdev[0]['bssid']
+    params = hs20_ap_params()
+    params['hessid'] = bssid
+    hostapd.add_ap(apdev[0], params)
+
+    dev[0].hs20_enable()
+    for consortium in [ "112233", "ffffff,1020304050,eeeeee" ]:
+        id = dev[0].add_cred_values({ 'username': "user",
+                                      'password': "password",
+                                      'domain': "my.home.example.com",
+                                      'ca_cert': "auth_serv/ca.pem",
+                                      'roaming_consortiums': consortium,
+                                      'eap': "PEAP" })
+        interworking_select(dev[0], bssid, "roaming", freq="2412")
+        interworking_connect(dev[0], bssid, "PEAP")
+        check_sp_type(dev[0], "roaming")
+        dev[0].request("INTERWORKING_SELECT auto freq=2412")
+        ev = dev[0].wait_event(["INTERWORKING-ALREADY-CONNECTED"], timeout=15)
+        if ev is None:
+            raise Exception("Timeout on already-connected event")
+        dev[0].remove_cred(id)
+
 def test_ap_hs20_roaming_consortium_invalid(dev, apdev):
     """Hotspot 2.0 connection and invalid roaming consortium ANQP-element"""
     bssid = apdev[0]['bssid']
index c80e16088e1cae829c19bbf45591a9428a20ab85..5992c51fdb4d5fbbdf88d111509ed925a20b9f2b 100644 (file)
@@ -379,7 +379,8 @@ class WpaSupplicant:
         quoted = [ "realm", "username", "password", "domain", "imsi",
                    "excluded_ssid", "milenage", "ca_cert", "client_cert",
                    "private_key", "domain_suffix_match", "provisioning_sp",
-                   "roaming_partner", "phase1", "phase2", "private_key_passwd" ]
+                   "roaming_partner", "phase1", "phase2", "private_key_passwd",
+                   "roaming_consortiums" ]
         for field in quoted:
             if field in params:
                 self.set_cred_quoted(id, field, params[field])