Browse Source

tests: Verify disallow_aps with Interworking

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 11 years ago
parent
commit
b4264f8f67
2 changed files with 40 additions and 0 deletions
  1. 39 0
      tests/hwsim/test_ap_hs20.py
  2. 1 0
      tests/hwsim/wpasupplicant.py

+ 39 - 0
tests/hwsim/test_ap_hs20.py

@@ -285,6 +285,45 @@ def test_ap_hs20_multiple_connects(dev, apdev):
     if len(networks) > 1:
         raise Exception("Duplicated network block detected")
 
+def test_ap_hs20_disallow_aps(dev, apdev):
+    """Hotspot 2.0 connection and disallow_aps"""
+    bssid = apdev[0]['bssid']
+    params = hs20_ap_params()
+    params['hessid'] = bssid
+    hostapd.add_ap(apdev[0]['ifname'], params)
+
+    dev[0].hs20_enable()
+    values = { 'realm': "example.com",
+               'username': "hs20-test",
+               'password': "password",
+               'domain': "example.com" }
+    id = dev[0].add_cred_values(values)
+
+    logger.info("Verify disallow_aps bssid")
+    dev[0].request("SET disallow_aps bssid " + bssid.translate(None, ':'))
+    dev[0].request("INTERWORKING_SELECT auto")
+    ev = dev[0].wait_event(["INTERWORKING-NO-MATCH"], timeout=15)
+    if ev is None:
+        raise Exception("Network selection timed out")
+    dev[0].dump_monitor()
+
+    logger.info("Verify disallow_aps ssid")
+    dev[0].request("SET disallow_aps ssid 746573742d68733230")
+    dev[0].request("INTERWORKING_SELECT auto")
+    ev = dev[0].wait_event(["INTERWORKING-NO-MATCH"], timeout=15)
+    if ev is None:
+        raise Exception("Network selection timed out")
+    dev[0].dump_monitor()
+
+    logger.info("Verify disallow_aps clear")
+    dev[0].request("SET disallow_aps ")
+    interworking_select(dev[0], bssid, "home")
+
+    dev[0].request("SET disallow_aps bssid " + bssid.translate(None, ':'))
+    ret = dev[0].request("INTERWORKING_CONNECT " + bssid)
+    if "FAIL" not in ret:
+        raise Exception("INTERWORKING_CONNECT to disallowed BSS not rejected")
+
 def policy_test(dev, ap, values, only_one=True):
     dev.dump_monitor()
     logger.info("Verify network selection to AP " + ap['ifname'])

+ 1 - 0
tests/hwsim/wpasupplicant.py

@@ -60,6 +60,7 @@ class WpaSupplicant:
         self.request("SET p2p_add_cli_chan 0")
         self.request("SET p2p_no_go_freq ")
         self.request("SET p2p_pref_chan ")
+        self.request("SET disallow_aps ")
         self.request("P2P_SET per_sta_psk 0")
         self.request("P2P_SET disabled 0")
         self.request("P2P_SERVICE_FLUSH")