]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix bgscan_simple_beacon_loss with REPORTS_TX_ACK_STATUS
authorJouni Malinen <j@w1.fi>
Sat, 21 Mar 2020 16:13:28 +0000 (18:13 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 21 Mar 2020 16:13:28 +0000 (18:13 +0200)
Stopping the AP from beaconing will also stop it from acknowledging
frames and that resulted in bgscan_simple_beacon_loss failing when
mac80211_hwsim is registering REPORTS_TX_ACK_STATUS. Work around this by
moving to using PMF so that the station ignores the unprotected
deauthentiation frames from the AP and also disabling SA Query. This
allows the AP to be stopped and restarted with large enough Beacon
interval to allow the station to detect beacon loss.

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

index f418f56da5be09138387c599392cdcf4304655c4..0387406fe3a1e5570ef515a06b13d50504b7881e 100644 (file)
@@ -71,13 +71,21 @@ def test_bgscan_simple(dev, apdev):
 
 def test_bgscan_simple_beacon_loss(dev, apdev):
     """bgscan_simple and beacon loss"""
-    hapd = hostapd.add_ap(apdev[0], {"ssid": "bgscan"})
-
-    dev[0].connect("bgscan", key_mgmt="NONE", scan_freq="2412",
-                   bgscan="simple:1:-20:2")
+    params = hostapd.wpa2_params(ssid="bgscan", passphrase="12345678")
+    params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
+    params["ieee80211w"] = "2"
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].set("disable_sa_query", "1")
+    dev[0].connect("bgscan", ieee80211w="2", key_mgmt="WPA-PSK-SHA256",
+                   psk="12345678", scan_freq="2412", bgscan="simple:1:-20:2")
     hapd.set("ext_mgmt_frame_handling", "1")
     if "OK" not in hapd.request("STOP_AP"):
         raise Exception("Failed to stop AP")
+    hapd.disable()
+    hapd.set("ssid", "foo")
+    hapd.set("beacon_int", "10000")
+    hapd.enable()
     ev = dev[0].wait_event(["CTRL-EVENT-BEACON-LOSS"], timeout=10)
     if ev is None:
         raise Exception("Beacon loss not reported")