tests: ap_hs20: Add more wait_sta()
We should always wait_sta() so that we know we can even deauth next, otherwise the key might not be installed yet by the time we try to connect to the next AP. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
0f896ded9d
commit
01afbeaf9d
1 changed files with 36 additions and 30 deletions
|
@ -1553,7 +1553,7 @@ def _test_ap_hs20_gas_while_associated_with_pmf(dev, apdev):
|
||||||
bssid = apdev[0]['bssid']
|
bssid = apdev[0]['bssid']
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['hessid'] = bssid
|
params['hessid'] = bssid
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
bssid2 = apdev[1]['bssid']
|
bssid2 = apdev[1]['bssid']
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
|
@ -1571,6 +1571,7 @@ def _test_ap_hs20_gas_while_associated_with_pmf(dev, apdev):
|
||||||
'domain': "example.com"})
|
'domain': "example.com"})
|
||||||
interworking_select(dev[0], bssid, "home", freq="2412")
|
interworking_select(dev[0], bssid, "home", freq="2412")
|
||||||
interworking_connect(dev[0], bssid, "TTLS")
|
interworking_connect(dev[0], bssid, "TTLS")
|
||||||
|
hapd.wait_sta()
|
||||||
|
|
||||||
logger.info("Verifying GAS query while associated")
|
logger.info("Verifying GAS query while associated")
|
||||||
dev[0].request("FETCH_ANQP")
|
dev[0].request("FETCH_ANQP")
|
||||||
|
@ -1739,8 +1740,10 @@ def test_ap_hs20_disallow_aps(dev, apdev):
|
||||||
if "FAIL" not in dev[0].request("INTERWORKING_CONNECT 00:11:22:33:44:55"):
|
if "FAIL" not in dev[0].request("INTERWORKING_CONNECT 00:11:22:33:44:55"):
|
||||||
raise Exception("Invalid INTERWORKING_CONNECT not rejected")
|
raise Exception("Invalid INTERWORKING_CONNECT not rejected")
|
||||||
|
|
||||||
def policy_test(dev, ap, values, only_one=True):
|
def policy_test(dev, ap, hapd, values, only_one=True):
|
||||||
dev.dump_monitor()
|
dev.dump_monitor()
|
||||||
|
if hapd is not None:
|
||||||
|
hapd.dump_monitor()
|
||||||
if ap:
|
if ap:
|
||||||
logger.info("Verify network selection to AP " + ap['ifname'])
|
logger.info("Verify network selection to AP " + ap['ifname'])
|
||||||
bssid = ap['bssid']
|
bssid = ap['bssid']
|
||||||
|
@ -1776,6 +1779,9 @@ def policy_test(dev, ap, values, only_one=True):
|
||||||
if bssid and conn_bssid != bssid:
|
if bssid and conn_bssid != bssid:
|
||||||
raise Exception("bssid information points to incorrect BSS")
|
raise Exception("bssid information points to incorrect BSS")
|
||||||
|
|
||||||
|
if hapd is not None:
|
||||||
|
hapd.wait_sta()
|
||||||
|
|
||||||
dev.remove_cred(id)
|
dev.remove_cred(id)
|
||||||
dev.dump_monitor()
|
dev.dump_monitor()
|
||||||
return events
|
return events
|
||||||
|
@ -1794,35 +1800,35 @@ def test_ap_hs20_prefer_home(dev, apdev):
|
||||||
check_eap_capa(dev[0], "MSCHAPV2")
|
check_eap_capa(dev[0], "MSCHAPV2")
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['domain_name'] = "example.org"
|
params['domain_name'] = "example.org"
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['ssid'] = "test-hs20-other"
|
params['ssid'] = "test-hs20-other"
|
||||||
params['domain_name'] = "example.com"
|
params['domain_name'] = "example.com"
|
||||||
hostapd.add_ap(apdev[1], params)
|
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||||
|
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['domain'] = "example.com"
|
values['domain'] = "example.com"
|
||||||
policy_test(dev[0], apdev[1], values, only_one=False)
|
policy_test(dev[0], apdev[1], hapd1, values, only_one=False)
|
||||||
values['domain'] = "example.org"
|
values['domain'] = "example.org"
|
||||||
policy_test(dev[0], apdev[0], values, only_one=False)
|
policy_test(dev[0], apdev[0], hapd0, values, only_one=False)
|
||||||
|
|
||||||
def test_ap_hs20_req_home_ois(dev, apdev):
|
def test_ap_hs20_req_home_ois(dev, apdev):
|
||||||
"""Hotspot 2.0 required roaming consortium"""
|
"""Hotspot 2.0 required roaming consortium"""
|
||||||
check_eap_capa(dev[0], "MSCHAPV2")
|
check_eap_capa(dev[0], "MSCHAPV2")
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['ssid'] = "test-hs20-other"
|
params['ssid'] = "test-hs20-other"
|
||||||
params['roaming_consortium'] = ["223344"]
|
params['roaming_consortium'] = ["223344"]
|
||||||
hostapd.add_ap(apdev[1], params)
|
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||||
|
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['required_home_ois'] = ["223344"]
|
values['required_home_ois'] = ["223344"]
|
||||||
policy_test(dev[0], apdev[1], values)
|
policy_test(dev[0], apdev[1], hapd1, values)
|
||||||
values['required_home_ois'] = ["112233"]
|
values['required_home_ois'] = ["112233"]
|
||||||
policy_test(dev[0], apdev[0], values)
|
policy_test(dev[0], apdev[0], hapd0, values)
|
||||||
|
|
||||||
id = dev[0].add_cred()
|
id = dev[0].add_cred()
|
||||||
dev[0].set_cred_quoted(id, "required_home_ois", "112233")
|
dev[0].set_cred_quoted(id, "required_home_ois", "112233")
|
||||||
|
@ -1861,22 +1867,22 @@ def test_ap_hs20_excluded_ssid(dev, apdev):
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['roaming_consortium'] = ["223344"]
|
params['roaming_consortium'] = ["223344"]
|
||||||
params['anqp_3gpp_cell_net'] = "555,444"
|
params['anqp_3gpp_cell_net'] = "555,444"
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['ssid'] = "test-hs20-other"
|
params['ssid'] = "test-hs20-other"
|
||||||
params['roaming_consortium'] = ["223344"]
|
params['roaming_consortium'] = ["223344"]
|
||||||
params['anqp_3gpp_cell_net'] = "555,444"
|
params['anqp_3gpp_cell_net'] = "555,444"
|
||||||
hostapd.add_ap(apdev[1], params)
|
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||||
|
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['excluded_ssid'] = "test-hs20"
|
values['excluded_ssid'] = "test-hs20"
|
||||||
events = policy_test(dev[0], apdev[1], values)
|
events = policy_test(dev[0], apdev[1], hapd1, values)
|
||||||
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1:
|
if len(ev) != 1:
|
||||||
raise Exception("Excluded network not reported")
|
raise Exception("Excluded network not reported")
|
||||||
values['excluded_ssid'] = "test-hs20-other"
|
values['excluded_ssid'] = "test-hs20-other"
|
||||||
events = policy_test(dev[0], apdev[0], values)
|
events = policy_test(dev[0], apdev[0], hapd0, values)
|
||||||
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[1]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[1]['bssid'] in e]
|
||||||
if len(ev) != 1:
|
if len(ev) != 1:
|
||||||
raise Exception("Excluded network not reported")
|
raise Exception("Excluded network not reported")
|
||||||
|
@ -1886,7 +1892,7 @@ def test_ap_hs20_excluded_ssid(dev, apdev):
|
||||||
values['eap'] = "TTLS"
|
values['eap'] = "TTLS"
|
||||||
values['phase2'] = "auth=MSCHAPV2"
|
values['phase2'] = "auth=MSCHAPV2"
|
||||||
values['excluded_ssid'] = "test-hs20"
|
values['excluded_ssid'] = "test-hs20"
|
||||||
events = policy_test(dev[0], apdev[1], values)
|
events = policy_test(dev[0], apdev[1], hapd1, values)
|
||||||
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1:
|
if len(ev) != 1:
|
||||||
raise Exception("Excluded network not reported")
|
raise Exception("Excluded network not reported")
|
||||||
|
@ -1894,7 +1900,7 @@ def test_ap_hs20_excluded_ssid(dev, apdev):
|
||||||
values = {'imsi': "555444-333222111", 'eap': "SIM",
|
values = {'imsi': "555444-333222111", 'eap': "SIM",
|
||||||
'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123",
|
'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123",
|
||||||
'excluded_ssid': "test-hs20"}
|
'excluded_ssid': "test-hs20"}
|
||||||
events = policy_test(dev[0], apdev[1], values)
|
events = policy_test(dev[0], apdev[1], hapd1, values)
|
||||||
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-BLACKLISTED " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1:
|
if len(ev) != 1:
|
||||||
raise Exception("Excluded network not reported")
|
raise Exception("Excluded network not reported")
|
||||||
|
@ -1993,43 +1999,43 @@ def test_ap_hs20_roaming_partner_preference(dev, apdev):
|
||||||
check_eap_capa(dev[0], "MSCHAPV2")
|
check_eap_capa(dev[0], "MSCHAPV2")
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['domain_name'] = "roaming.example.org"
|
params['domain_name'] = "roaming.example.org"
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['ssid'] = "test-hs20-other"
|
params['ssid'] = "test-hs20-other"
|
||||||
params['domain_name'] = "roaming.example.net"
|
params['domain_name'] = "roaming.example.net"
|
||||||
hostapd.add_ap(apdev[1], params)
|
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||||
|
|
||||||
logger.info("Verify default vs. specified preference")
|
logger.info("Verify default vs. specified preference")
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['roaming_partner'] = "roaming.example.net,1,127,*"
|
values['roaming_partner'] = "roaming.example.net,1,127,*"
|
||||||
policy_test(dev[0], apdev[1], values, only_one=False)
|
policy_test(dev[0], apdev[1], hapd1, values, only_one=False)
|
||||||
values['roaming_partner'] = "roaming.example.net,1,129,*"
|
values['roaming_partner'] = "roaming.example.net,1,129,*"
|
||||||
policy_test(dev[0], apdev[0], values, only_one=False)
|
policy_test(dev[0], apdev[0], hapd0, values, only_one=False)
|
||||||
|
|
||||||
logger.info("Verify partial FQDN match")
|
logger.info("Verify partial FQDN match")
|
||||||
values['roaming_partner'] = "example.net,0,0,*"
|
values['roaming_partner'] = "example.net,0,0,*"
|
||||||
policy_test(dev[0], apdev[1], values, only_one=False)
|
policy_test(dev[0], apdev[1], hapd1, values, only_one=False)
|
||||||
values['roaming_partner'] = "example.net,0,255,*"
|
values['roaming_partner'] = "example.net,0,255,*"
|
||||||
policy_test(dev[0], apdev[0], values, only_one=False)
|
policy_test(dev[0], apdev[0], hapd0, values, only_one=False)
|
||||||
|
|
||||||
def test_ap_hs20_max_bss_load(dev, apdev):
|
def test_ap_hs20_max_bss_load(dev, apdev):
|
||||||
"""Hotspot 2.0 and maximum BSS load"""
|
"""Hotspot 2.0 and maximum BSS load"""
|
||||||
check_eap_capa(dev[0], "MSCHAPV2")
|
check_eap_capa(dev[0], "MSCHAPV2")
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['bss_load_test'] = "12:200:20000"
|
params['bss_load_test'] = "12:200:20000"
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['ssid'] = "test-hs20-other"
|
params['ssid'] = "test-hs20-other"
|
||||||
params['bss_load_test'] = "5:20:10000"
|
params['bss_load_test'] = "5:20:10000"
|
||||||
hostapd.add_ap(apdev[1], params)
|
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||||
|
|
||||||
logger.info("Verify maximum BSS load constraint")
|
logger.info("Verify maximum BSS load constraint")
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['domain'] = "example.com"
|
values['domain'] = "example.com"
|
||||||
values['max_bss_load'] = "100"
|
values['max_bss_load'] = "100"
|
||||||
events = policy_test(dev[0], apdev[1], values, only_one=False)
|
events = policy_test(dev[0], apdev[1], hapd1, values, only_one=False)
|
||||||
|
|
||||||
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1 or "over_max_bss_load=1" not in ev[0]:
|
if len(ev) != 1 or "over_max_bss_load=1" not in ev[0]:
|
||||||
|
@ -2040,7 +2046,7 @@ def test_ap_hs20_max_bss_load(dev, apdev):
|
||||||
|
|
||||||
logger.info("Verify maximum BSS load does not prevent connection")
|
logger.info("Verify maximum BSS load does not prevent connection")
|
||||||
values['max_bss_load'] = "1"
|
values['max_bss_load'] = "1"
|
||||||
events = policy_test(dev[0], None, values)
|
events = policy_test(dev[0], None, None, values)
|
||||||
|
|
||||||
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1 or "over_max_bss_load=1" not in ev[0]:
|
if len(ev) != 1 or "over_max_bss_load=1" not in ev[0]:
|
||||||
|
@ -2058,13 +2064,13 @@ def test_ap_hs20_max_bss_load2(dev, apdev):
|
||||||
|
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['ssid'] = "test-hs20-other"
|
params['ssid'] = "test-hs20-other"
|
||||||
hostapd.add_ap(apdev[1], params)
|
hapd1 = hostapd.add_ap(apdev[1], params)
|
||||||
|
|
||||||
logger.info("Verify maximum BSS load constraint with AP advertisement")
|
logger.info("Verify maximum BSS load constraint with AP advertisement")
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['domain'] = "example.com"
|
values['domain'] = "example.com"
|
||||||
values['max_bss_load'] = "100"
|
values['max_bss_load'] = "100"
|
||||||
events = policy_test(dev[0], apdev[1], values, only_one=False)
|
events = policy_test(dev[0], apdev[1], hapd1, values, only_one=False)
|
||||||
|
|
||||||
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1 or "over_max_bss_load=1" not in ev[0]:
|
if len(ev) != 1 or "over_max_bss_load=1" not in ev[0]:
|
||||||
|
@ -2078,12 +2084,12 @@ def test_ap_hs20_max_bss_load_roaming(dev, apdev):
|
||||||
check_eap_capa(dev[0], "MSCHAPV2")
|
check_eap_capa(dev[0], "MSCHAPV2")
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
params['bss_load_test'] = "12:200:20000"
|
params['bss_load_test'] = "12:200:20000"
|
||||||
hostapd.add_ap(apdev[0], params)
|
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||||
|
|
||||||
values = default_cred()
|
values = default_cred()
|
||||||
values['domain'] = "roaming.example.com"
|
values['domain'] = "roaming.example.com"
|
||||||
values['max_bss_load'] = "100"
|
values['max_bss_load'] = "100"
|
||||||
events = policy_test(dev[0], apdev[0], values, only_one=True)
|
events = policy_test(dev[0], apdev[0], hapd0, values, only_one=True)
|
||||||
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
ev = [e for e in events if "INTERWORKING-AP " + apdev[0]['bssid'] in e]
|
||||||
if len(ev) != 1:
|
if len(ev) != 1:
|
||||||
raise Exception("No INTERWORKING-AP event")
|
raise Exception("No INTERWORKING-AP event")
|
||||||
|
|
Loading…
Reference in a new issue