]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: SA Query timeout
authorJouni Malinen <j@w1.fi>
Mon, 15 Apr 2019 21:36:40 +0000 (00:36 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 15 Apr 2019 21:48:27 +0000 (00:48 +0300)
Verify wpa_supplicant behavior on SA Query timeout and
disconnection/reconnection.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_pmf.py

index 071f9e629d91b32a90822068bc238a3ff8dfe8da..62f0947ffeab8406f5a6a2c75f202396e5a5ea34 100644 (file)
@@ -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")