]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add test that fails the MLD association after hostapd success
authorBenjamin Berg <benjamin.berg@intel.com>
Thu, 30 Oct 2025 17:56:06 +0000 (18:56 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 25 Jan 2026 18:31:12 +0000 (20:31 +0200)
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.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
src/drivers/driver_nl80211_event.c
tests/hwsim/test_eht.py

index 6c8ff867e3cc4023be2a35ddd02071fe6a92ff90..df0f008061bcb5046728d8c1191ba59118e8d32a 100644 (file)
@@ -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;
index 363805ea719a20e6edf74f325dc02f2d72513cb4..d90683bb850e63850bfdca7c86a3e438f72317f5 100644 (file)
@@ -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), \