From 1ea75c7ce0acc6595d1e174e6f43a393c92412ed Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 3 Jul 2016 21:20:08 +0300 Subject: [PATCH] tests: Hotspot 2.0 network selection and invalid GAS response Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_hs20.py | 124 ++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index 8d9e26e2c..ec9b4cac3 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -23,6 +23,7 @@ from tshark import run_tshark from wlantest import Wlantest from wpasupplicant import WpaSupplicant from test_ap_eap import check_eap_capa, check_domain_match_full +from test_gas import gas_rx, parse_gas, action_response, send_gas_resp, ACTION_CATEG_PUBLIC, GAS_INITIAL_RESPONSE def hs20_ap_params(ssid="test-hs20"): params = hostapd.wpa2_params(ssid=ssid) @@ -4155,3 +4156,126 @@ def test_ap_hs20_interworking_oom(dev, apdev): if ev is None: raise Exception("ANQP did not start") wait_fail_trigger(dev[0], "GET_ALLOC_FAIL") + +def test_ap_hs20_anqp_invalid_gas_response(dev, apdev): + """Hotspot 2.0 network selection and invalid GAS response""" + bssid = apdev[0]['bssid'] + params = hs20_ap_params() + params['hessid'] = bssid + hapd = hostapd.add_ap(apdev[0], params) + + dev[0].scan_for_bss(bssid, freq="2412") + hapd.set("ext_mgmt_frame_handling", "1") + + dev[0].hs20_enable() + + id = dev[0].add_cred_values({ 'realm': "example.com", + 'username': "test", + 'password': "secret", + 'domain': "example.com", + 'roaming_consortium': "112234", + 'eap': 'TTLS' }) + dev[0].request("INTERWORKING_SELECT freq=2412") + + query = gas_rx(hapd) + gas = parse_gas(query['payload']) + + logger.info("ANQP: Unexpected Advertisement Protocol in response") + resp = action_response(query) + adv_proto = struct.pack('8B', 108, 6, 127, 0xdd, 0x00, 0x11, 0x22, 0x33) + data = struct.pack('