diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index 9e125f25b..6d415b80d 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/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']) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 32b7267ff..9722309a2 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/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")