]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Extend MBSSID testing for beacon protection
authorSai Pratyusha Magam <smagam@qti.qualcomm.com>
Mon, 8 Dec 2025 00:16:50 +0000 (05:46 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 23 Jan 2026 11:58:38 +0000 (13:58 +0200)
Add a new test case for MBSSID with beacon protection enabled with a STA
associating on the non-transmitting BSS followed by a STA association on
the transmitting BSS.

Signed-off-by: Sai Pratyusha Magam <smagam@qti.qualcomm.com>
tests/hwsim/test_he_mbssid.py

index 72a53e29ba105e9c55ae23ed1f3b32f668b41272..386b84bbc6658b3f45ae86dbd1ba1c16859121c1 100644 (file)
@@ -416,8 +416,15 @@ def test_he_ap_ema(dev, apdev, params):
         subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'],
                          'address', apdev[0]['bssid']])
 
-def test_he_ap_mbssid_beacon_prot(dev, apdev, params):
-    """HE AP MBSSID beacon protection"""
+def test_he_ap_mbssid_beacon_prot_tx_then_non_tx(dev, apdev, params):
+    """HE AP MBSSID beacon protection with Association on Tx BSS followed by non-Tx BSS"""
+    run_mbssid_beacon_prot(dev, apdev, params, False)
+
+def test_mbssid_beacon_prot_non_tx_then_tx(dev, apdev, params):
+    """HE AP MBSSID beacon protection with Association on non-Tx BSS followed by Tx BSS"""
+    run_mbssid_beacon_prot(dev, apdev, params, True)
+
+def run_mbssid_beacon_prot(dev, apdev, params, non_tx_first):
     check_sae_capab(dev[0])
     check_sae_capab(dev[1])
     f, fname, ifname = mbssid_create_cfg_file(apdev, params)
@@ -439,10 +446,16 @@ def test_he_ap_mbssid_beacon_prot(dev, apdev, params):
         dev[1].set("sae_groups", "")
         hapd, pid = mbssid_start_ap(dev, apdev, params, fname, ifname, None,
                                     only_start_ap=True)
-        dev[0].connect("bss-0", psk="12345678", key_mgmt="SAE",
-                       ieee80211w="2", beacon_prot="1", scan_freq="2412")
-        dev[1].connect("bss-1", psk="another password", key_mgmt="SAE",
-                       ieee80211w="2", beacon_prot="1", scan_freq="2412")
+        if non_tx_first:
+            dev[1].connect("bss-1", psk="another password", key_mgmt="SAE",
+                           ieee80211w="2", beacon_prot="1", scan_freq="2412")
+            dev[0].connect("bss-0", psk="12345678", key_mgmt="SAE",
+                           ieee80211w="2", beacon_prot="1", scan_freq="2412")
+        else:
+            dev[0].connect("bss-0", psk="12345678", key_mgmt="SAE",
+                           ieee80211w="2", beacon_prot="1", scan_freq="2412")
+            dev[1].connect("bss-1", psk="another password", key_mgmt="SAE",
+                           ieee80211w="2", beacon_prot="1", scan_freq="2412")
 
         beacon_loss0 = False
         beacon_loss1 = False
@@ -455,8 +468,10 @@ def test_he_ap_mbssid_beacon_prot(dev, apdev, params):
 
         mbssid_stop_ap(hapd, pid)
 
-        if beacon_loss0 or beacon_loss1:
-            raise Exception("Beacon loss detected")
+        if beacon_loss0:
+            raise Exception("Beacon loss detected on TX BSS")
+        if beacon_loss1:
+            raise Exception("Beacon loss detected on non-TX BSS")
     finally:
         subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'],
                          'address', apdev[0]['bssid']])