]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Beacon protection and reconnection
authorJouni Malinen <quic_jouni@quicinc.com>
Tue, 5 Sep 2023 17:12:36 +0000 (20:12 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 5 Sep 2023 17:38:47 +0000 (20:38 +0300)
Regression test case for the issue fixed in the previous commit.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
tests/hwsim/test_ap_pmf.py

index 7b7e5a29e17319f58158654d12301e479a48c947..fe0955ba253968e159ca48af41ba22fcb1e28de1 100644 (file)
@@ -1435,6 +1435,33 @@ def run_ap_pmf_beacon_protection_mismatch(dev, apdev, clear):
     if ev is None:
         raise Exception("WNM-Notification Request frame not reported")
 
+def test_ap_pmf_beacon_protection_reconnect(dev, apdev):
+    """Beacon protection and reconnection"""
+    ssid = "test-beacon-prot"
+    params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
+    params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
+    params["ieee80211w"] = "2"
+    params["beacon_prot"] = "1"
+    params["group_mgmt_cipher"] = "AES-128-CMAC"
+    try:
+        hapd = hostapd.add_ap(apdev[0], params)
+    except Exception as e:
+        if "Failed to enable hostapd interface" in str(e):
+            raise HwsimSkip("Beacon protection not supported")
+        raise
+
+    dev[0].connect(ssid, psk="12345678", ieee80211w="2", beacon_prot="1",
+                   key_mgmt="WPA-PSK-SHA256", proto="WPA2", scan_freq="2412")
+    dev[0].request("DISCONNECT")
+    dev[0].wait_disconnected()
+    dev[0].request("RECONNECT")
+    dev[0].wait_connected()
+    time.sleep(1)
+    check_mac80211_bigtk(dev[0], hapd)
+    ev = dev[0].wait_event(["CTRL-EVENT-BEACON-LOSS"], timeout=5)
+    if ev is not None:
+        raise Exception("Beacon loss detected")
+
 def test_ap_pmf_sta_global_require(dev, apdev):
     """WPA2-PSK AP with PMF optional and wpa_supplicant pmf=2"""
     ssid = "test-pmf-optional"