[PATCH 2/2] tests: MLD connection with BSSID preference

Andrei Otcheretianski andrei.otcheretianski at intel.com
Wed Nov 25 04:32:24 PST 2026


From: Ilan Peer <ilan.peer at intel.com>

Connect to a two link AP MLD (2.4 GHz and 5 GHz) with
mld_connect_bssid_pref selecting either link as the association link.
With the 5 GHz link as the association link, the 2.4 GHz link is the
reported link and must not inherit the band specific elements of the
5 GHz link.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_eht.py | 72 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index 5ce2edc9c5..bcb59f56a1 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -3284,3 +3284,75 @@ def test_eht_mld_preferred_bssid(dev, apdev):
                                                  bssid=unknown_bssid)
         except:
             logger.info(f"Connection failed as expected with unknown bssid: {unknown_bssid}")
+
+def _test_eht_mld_connect_pref(dev, apdev, ap_pref=None):
+    """EHT MLD AP with MLD client SAE H2E connection with bssid/band pref"""
+
+    with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+        HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+
+        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+        wpas.interface_add(wpas_iface)
+
+        passphrase = 'qwertyuiop'
+        ssid = "mld_connect_pref"
+        params = eht_mld_ap_wpa2_params(ssid, passphrase,
+                                        key_mgmt="SAE", mfp="2", pwe='1')
+
+        hapds = []
+        params['country_code'] = 'US'
+        hapds.append(eht_mld_enable_ap(hapd_iface, 0, params))
+
+        params['hw_mode'] = 'a'
+        params['channel'] = '36'
+
+        try:
+            hapds.append(eht_mld_enable_ap(hapd_iface, 1, params))
+
+            wpas.set("sae_pwe", "1")
+
+            if ap_pref is not None:
+                if ap_pref != 0 and ap_pref != 1:
+                    raise Exception("Invalid BSSID preference")
+
+                connect_ap = hapds[ap_pref]
+                wpas.set("mld_connect_bssid_pref", connect_ap.own_addr())
+            else:
+                raise Exception("No preference specified")
+
+            res = wpas.request("SCAN freq=2412,5180")
+            if "FAIL" in res:
+                raise Exception("Failed to start scan")
+
+            ev = wpas.wait_event(["CTRL-EVENT-SCAN-STARTED"])
+            if ev is None:
+                raise Exception("Scan did not start")
+
+            ev = wpas.wait_event(["CTRL-EVENT-SCAN-RESULTS"])
+            if ev is None:
+                raise Exception("Scan did not complete")
+
+            wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 5180",
+                         key_mgmt="SAE", ieee80211w="2")
+
+            eht_verify_status(wpas, connect_ap, connect_ap.get_status_field("freq"),
+                              20, is_ht=True, mld=True, valid_links=3, active_links=3)
+
+            eht_verify_wifi_version(wpas)
+            for hapd in hapds:
+                traffic_test(wpas, hapd)
+
+            wpas.disconnect_and_stop_scan()
+        finally:
+            wpas.cmd_execute(['iw', 'reg', 'set', '00'])
+            wait_regdom_changes(wpas)
+            for hapd in hapds:
+                disable_hapd(hapd)
+
+def test_eht_mld_connect_pref1(dev, apdev):
+    """EHT MLD AP with MLD client SAE H2E connection with BSSID preference to first AP"""
+    _test_eht_mld_connect_pref(dev, apdev, ap_pref=0)
+
+def test_eht_mld_connect_pref2(dev, apdev):
+    """EHT MLD AP with MLD client SAE H2E connection with BSSID preference to second AP"""
+    _test_eht_mld_connect_pref(dev, apdev, ap_pref=1)
-- 
2.56.1




More information about the Hostap mailing list