From 1815317906c8ffb89fc0e5396fef73a21416a950 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 27 Feb 2014 00:49:52 +0200 Subject: [PATCH] tests: Verify req_conn_capab as cred parameter Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_hs20.py | 44 ++++++++++++++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index fdc8e7fb5..974dbcdc6 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -1028,6 +1028,50 @@ def test_ap_hs20_multi_cred_sp_prio2(dev, apdev): if conn_bssid != bssid2: raise Exception("Connected to incorrect BSS") +def test_ap_hs20_req_conn_capab(dev, apdev): + """Hotspot 2.0 network selection with req_conn_capab""" + bssid = apdev[0]['bssid'] + params = hs20_ap_params() + hostapd.add_ap(apdev[0]['ifname'], params) + + dev[0].hs20_enable() + logger.info("Not used in home network") + id = dev[0].add_cred_values({ 'realm': "example.com", + 'username': "hs20-test", + 'password': "password", + 'domain': "example.com", + 'req_conn_capab': "6:1234" }) + dev[0].request("INTERWORKING_SELECT freq=2412") + ev = dev[0].wait_event(["INTERWORKING-AP"]) + if ev is None: + raise Exception("Network selection timed out"); + if "type=home" not in ev: + raise Exception("Unexpected network type") + if "conn_capab_missing=1" in ev: + raise Exception("req_conn_capab used in home network") + + logger.info("Used in roaming network") + dev[0].remove_cred(id) + id = dev[0].add_cred_values({ 'realm': "example.com", + 'username': "hs20-test", + 'password': "password", + 'domain': "example.org", + 'req_conn_capab': "6:1234" }) + dev[0].request("INTERWORKING_SELECT freq=2412") + ev = dev[0].wait_event(["INTERWORKING-AP"]) + if ev is None: + raise Exception("Network selection timed out"); + if "type=roaming" not in ev: + raise Exception("Unexpected network type") + if "conn_capab_missing=1" not in ev: + raise Exception("Missing conn_capab not reported") + + logger.info("Verify that req_conn_capab does not prevent connection if no other network is available") + dev[0].request("INTERWORKING_SELECT auto freq=2412") + ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"], timeout=15) + if ev is None: + raise Exception("Connection timed out") + def test_ap_hs20_deauth_req_ess(dev, apdev): """Hotspot 2.0 connection and deauthentication request for ESS""" dev[0].request("SET pmf 2") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 9dfa037f8..d92dfaab6 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -217,7 +217,7 @@ class WpaSupplicant: not_quoted = [ "eap", "roaming_consortium", "required_roaming_consortium", "sp_priority", - "max_bss_load", "update_identifier" ] + "max_bss_load", "update_identifier", "req_conn_capab" ] for field in not_quoted: if field in params: self.set_cred(id, field, params[field])