[PATCH] tests: Add test that fails the MLD association after hostapd success

Benjamin Berg benjamin at sipsolutions.net
Thu Oct 30 10:56:06 PDT 2025


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

This test checks the flow where an error happens on the first
association attempt but everything looks fine from the perspective of
the AP. In this case, the AP will receive a second authentication even
though it thinks the client is already associated.

Currently this test triggers a segfault in hostapd.

Signed-off-by: Benjamin Berg <benjamin.berg at intel.com>
---
 src/drivers/driver_nl80211_event.c |  4 ++++
 tests/hwsim/test_eht.py            | 33 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
index 6c8ff867e3..df0f008061 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -288,6 +288,10 @@ static void mlme_event_assoc(struct wpa_driver_nl80211_data *drv,
 	}
 
 	status = le_to_host16(mgmt->u.assoc_resp.status_code);
+
+	if (TEST_FAIL_TAG("denied-unspec"))
+		status = WLAN_STATUS_ASSOC_DENIED_UNSPEC;
+
 	if (status != WLAN_STATUS_SUCCESS) {
 		os_memset(&event, 0, sizeof(event));
 		event.assoc_reject.bssid = mgmt->bssid;
diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index 339efaa103..8e846a2358 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -1067,6 +1067,39 @@ def test_eht_all_links_rejected(dev, apdev, params):
             # connects.
             wpas.wait_connected(timeout=15)
 
+def test_eht_assoc_failure(dev, apdev, params):
+    """EHT MLD AP with MLD client that fails the association the first time"""
+    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)
+        check_sae_capab(wpas)
+
+        ssid = "mld_ap"
+        passphrase = 'qwertyuiop'
+        link_params = eht_mld_ap_wpa2_params(ssid, passphrase, mfp="2",
+                                             key_mgmt="SAE", pwe='2')
+        link_params['channel'] = '1'
+        link_params['bssid'] = '00:11:22:33:44:01'
+        hapd0 = eht_mld_enable_ap(hapd_iface, 0, link_params)
+
+        link_params['channel'] = '6'
+        link_params['bssid'] = '00:11:22:33:44:02'
+        hapd1 = eht_mld_enable_ap(hapd_iface, 1, link_params)
+
+        wpas.set("sae_pwe", "2")
+        with fail_test(wpas, 1, "denied-unspec:mlme_event_assoc"):
+            wpas.connect(ssid, sae_password=passphrase, ieee80211w="2",
+                         key_mgmt="SAE", scan_freq="2412")
+
+        # connection succeeds on the second attempt which uses an open
+        # authentication
+        eht_verify_status(wpas, hapd1, 2437, 20, is_ht=True, mld=True,
+                          valid_links=3, active_links=3)
+        traffic_test(wpas, hapd0)
+        traffic_test(wpas, hapd1)
+
 def test_eht_non_assoc_links_rejected(dev, apdev, params):
     """EHT MLD AP with all non assoc links rejected in association"""
     with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
-- 
2.51.0




More information about the Hostap mailing list