From 1bef9e87294ff732a600593e9daac7e943f27dd0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 27 Feb 2016 11:47:58 +0200 Subject: [PATCH] tests: GAS query with another AP while associated and using PMF Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_hs20.py | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index bb6bfeff2..5cf784af4 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -951,6 +951,51 @@ def _test_ap_hs20_gas_while_associated_with_pmf(dev, apdev): if ev is None: raise Exception("Operation timed out") +def test_ap_hs20_gas_with_another_ap_while_using_pmf(dev, apdev): + """GAS query with another AP while associated and using PMF""" + check_eap_capa(dev[0], "MSCHAPV2") + try: + _test_ap_hs20_gas_with_another_ap_while_using_pmf(dev, apdev) + finally: + dev[0].request("SET pmf 0") + +def _test_ap_hs20_gas_with_another_ap_while_using_pmf(dev, apdev): + bssid = apdev[0]['bssid'] + params = hs20_ap_params() + params['hessid'] = bssid + hostapd.add_ap(apdev[0]['ifname'], params) + + bssid2 = apdev[1]['bssid'] + params = hs20_ap_params() + params['hessid'] = bssid2 + params['nai_realm'] = [ "0,no-match.example.org,13[5:6],21[2:4][5:7]" ] + hostapd.add_ap(apdev[1]['ifname'], params) + + dev[0].hs20_enable() + dev[0].request("SET pmf 2") + id = dev[0].add_cred_values({ 'realm': "example.com", + 'ca_cert': "auth_serv/ca.pem", + 'username': "hs20-test", + 'password': "password", + 'domain': "example.com" }) + interworking_select(dev[0], bssid, "home", freq="2412") + interworking_connect(dev[0], bssid, "TTLS") + dev[0].dump_monitor() + + logger.info("Verifying GAS query with same AP while associated") + dev[0].request("ANQP_GET " + bssid + " 263") + ev = dev[0].wait_event(["RX-ANQP"], timeout=5) + if ev is None: + raise Exception("ANQP operation timed out") + dev[0].dump_monitor() + + logger.info("Verifying GAS query with another AP while associated") + dev[0].scan_for_bss(bssid2, 2412) + dev[0].request("ANQP_GET " + bssid2 + " 263") + ev = dev[0].wait_event(["RX-ANQP"], timeout=5) + if ev is None: + raise Exception("ANQP operation timed out") + def test_ap_hs20_gas_frag_while_associated(dev, apdev): """Hotspot 2.0 connection with fragmented GAS query while associated""" check_eap_capa(dev[0], "MSCHAPV2")