From 9c4554a9b79fb6999458fa08483285fc5a731737 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 16 Apr 2019 00:36:40 +0300 Subject: [PATCH] tests: SA Query timeout Verify wpa_supplicant behavior on SA Query timeout and disconnection/reconnection. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_pmf.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/hwsim/test_ap_pmf.py b/tests/hwsim/test_ap_pmf.py index 071f9e629..62f0947ff 100644 --- a/tests/hwsim/test_ap_pmf.py +++ b/tests/hwsim/test_ap_pmf.py @@ -595,3 +595,38 @@ def test_ap_pmf_tkip_reject(dev, apdev): raise Exception("Unexpected status code in rejection: " + ev) dev[2].request("DISCONNECT") dev[2].dump_monitor() + +def test_ap_pmf_sa_query_timeout(dev, apdev): + """SA Query timeout""" + ssid = "test-pmf-required" + params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") + params["wpa_key_mgmt"] = "WPA-PSK-SHA256" + params["ieee80211w"] = "2" + hapd = hostapd.add_ap(apdev[0], params) + dev[0].connect(ssid, psk="12345678", ieee80211w="2", + key_mgmt="WPA-PSK-SHA256", proto="WPA2", + scan_freq="2412") + + hapd.set("ext_mgmt_frame_handling", "1") + if "OK" not in dev[0].request("UNPROT_DEAUTH"): + raise Exception("Triggering SA Query from the STA failed") + ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=2) + if ev is None: + raise Exception("No disconnection on SA Query timeout seen") + hapd.set("ext_mgmt_frame_handling", "0") + dev[0].wait_connected() + dev[0].dump_monitor() + + hapd.set("ext_mgmt_frame_handling", "1") + if "OK" not in dev[0].request("UNPROT_DEAUTH"): + raise Exception("Triggering SA Query from the STA failed") + ev = hapd.mgmt_rx() + hapd.set("ext_mgmt_frame_handling", "0") + dev[0].request("DISCONNECT") + dev[0].wait_disconnected() + dev[0].request("RECONNECT") + dev[0].wait_connected() + hapd.set("ext_mgmt_frame_handling", "1") + ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1.5) + if ev is not None: + raise Exception("Unexpected disconnection after reconnection seen")