[PATCH 18/21] tests: Extend HE MBSSID test to check BIGTK matches

Benjamin Berg benjamin at sipsolutions.net
Tue Oct 27 06:17:04 PDT 2026


From: Benjamin Berg <benjamin.berg at intel.com>

For CIP testing, we will need to do something similar. As such, it seems
reasonable to also add a more explicit check here (though make it
optional in case the kernel does not fully support it).

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 tests/hwsim/test_he_mbssid.py | 45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/tests/hwsim/test_he_mbssid.py b/tests/hwsim/test_he_mbssid.py
index 386b84bbc6..cc3c9b59f0 100644
--- a/tests/hwsim/test_he_mbssid.py
+++ b/tests/hwsim/test_he_mbssid.py
@@ -11,6 +11,7 @@ logger = logging.getLogger()
 import hwsim_utils, hostapd
 from wpasupplicant import WpaSupplicant
 from utils import *
+from test_ap_pmf import mac80211_read_key
 
 def mbssid_create_cfg_file(apdev, params, mbssid=1):
     hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
@@ -424,6 +425,37 @@ 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 get_mac80211_bigtks(dev):
+    phy = dev.get_driver_status_field("phyname")
+    keys = f"/sys/kernel/debug/ieee80211/{phy}/keys"
+
+    res = []
+
+    try:
+        for key in os.listdir(keys):
+            vals = mac80211_read_key(os.path.join(keys, key))
+
+            conf_flags = int(vals.get('conf_flags'), 0)
+
+            # group key (continue if pairwise)
+            if conf_flags & (1 << 3):
+                continue
+
+            if vals.get('algorithm') != "00-0f-ac:6":
+                continue
+
+            if int(vals.get('keyidx')) not in (6, 7):
+                continue
+
+            res.append({'keyidx': vals['keyidx'], 'key': vals['key']})
+    except TypeError:
+        raise HwsimSkip("debugfs does not have conf_flags support")
+    except OSError:
+        raise HwsimSkip("debugfs not supported in mac80211")
+
+    return res
+
 def run_mbssid_beacon_prot(dev, apdev, params, non_tx_first):
     check_sae_capab(dev[0])
     check_sae_capab(dev[1])
@@ -457,6 +489,17 @@ def run_mbssid_beacon_prot(dev, apdev, params, non_tx_first):
             dev[1].connect("bss-1", psk="another password", key_mgmt="SAE",
                            ieee80211w="2", beacon_prot="1", scan_freq="2412")
 
+        bigtk_mismatch = False
+        try:
+            dev0_bigtks = get_mac80211_bigtks(dev[0])
+            dev1_bigtks = get_mac80211_bigtks(dev[1])
+
+            if dev0_bigtks[0]['key'] != dev1_bigtks[0]['key']:
+                bigtk_mismatch = True
+        except HwsimSkip:
+            # We can still check that no beacon loss happened
+            pass
+
         beacon_loss0 = False
         beacon_loss1 = False
         ev = dev[1].wait_event(["CTRL-EVENT-BEACON-LOSS"], timeout=5)
@@ -472,6 +515,8 @@ def run_mbssid_beacon_prot(dev, apdev, params, non_tx_first):
             raise Exception("Beacon loss detected on TX BSS")
         if beacon_loss1:
             raise Exception("Beacon loss detected on non-TX BSS")
+        if bigtk_mismatch:
+            raise Exception("Installed BIGTKs did not match between STAs")
     finally:
         subprocess.call(['ip', 'link', 'set', 'dev', apdev[0]['ifname'],
                          'address', apdev[0]['bssid']])
-- 
2.56.0




More information about the Hostap mailing list