diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index 414257d30..775eb793e 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -935,6 +935,84 @@ def test_ap_hs20_roaming_consortium_invalid(dev, apdev): 'eap': "PEAP" }) interworking_select(dev[0], bssid, "home", freq="2412", no_match=True) +def test_ap_hs20_roaming_consortium_constraints(dev, apdev): + """Hotspot 2.0 connection and roaming consortium constraints""" + bssid = apdev[0]['bssid'] + params = hs20_ap_params() + params['hessid'] = bssid + params['bss_load_test'] = "12:200:20000" + hostapd.add_ap(apdev[0], params) + + dev[0].hs20_enable() + + vals = { 'username': "user", + 'password': "password", + 'domain': "example.com", + 'ca_cert': "auth_serv/ca.pem", + 'roaming_consortium': "fedcba", + 'eap': "TTLS" } + vals2 = vals.copy() + vals2['required_roaming_consortium'] = "223344" + id = dev[0].add_cred_values(vals2) + interworking_select(dev[0], bssid, "home", freq="2412", no_match=True) + dev[0].remove_cred(id) + + vals2 = vals.copy() + vals2['min_dl_bandwidth_home'] = "65500" + id = dev[0].add_cred_values(vals2) + dev[0].request("INTERWORKING_SELECT freq=2412") + ev = dev[0].wait_event(["INTERWORKING-AP"], timeout=15) + if ev is None: + raise Exception("No AP found") + if "below_min_backhaul=1" not in ev: + raise Exception("below_min_backhaul not reported") + dev[0].remove_cred(id) + + vals2 = vals.copy() + vals2['max_bss_load'] = "100" + id = dev[0].add_cred_values(vals2) + dev[0].request("INTERWORKING_SELECT freq=2412") + ev = dev[0].wait_event(["INTERWORKING-AP"], timeout=15) + if ev is None: + raise Exception("No AP found") + if "over_max_bss_load=1" not in ev: + raise Exception("over_max_bss_load not reported") + dev[0].remove_cred(id) + + vals2 = vals.copy() + vals2['req_conn_capab'] = "6:1234" + vals2['domain'] = 'example.org' + id = dev[0].add_cred_values(vals2) + + dev[0].request("INTERWORKING_SELECT freq=2412") + ev = dev[0].wait_event(["INTERWORKING-AP"], timeout=15) + if ev is None: + raise Exception("No AP found") + if "conn_capab_missing=1" not in ev: + raise Exception("conn_capab_missing not reported") + dev[0].remove_cred(id) + + values = default_cred() + values['roaming_consortium'] = "fedcba" + id3 = dev[0].add_cred_values(values) + + vals2 = vals.copy() + vals2['roaming_consortium'] = "fedcba" + vals2['priority'] = "2" + id = dev[0].add_cred_values(vals2) + + values = default_cred() + values['roaming_consortium'] = "fedcba" + id2 = dev[0].add_cred_values(values) + + dev[0].request("INTERWORKING_SELECT freq=2412") + ev = dev[0].wait_event(["INTERWORKING-AP"], timeout=15) + if ev is None: + raise Exception("No AP found") + dev[0].remove_cred(id) + dev[0].remove_cred(id2) + dev[0].remove_cred(id3) + def test_ap_hs20_username_roaming(dev, apdev): """Hotspot 2.0 connection in username/password credential (roaming)""" check_eap_capa(dev[0], "MSCHAPV2")