]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify AP MLD connection with link rejection
authorRameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Thu, 10 Apr 2025 20:07:50 +0000 (01:37 +0530)
committerJouni Malinen <j@w1.fi>
Sat, 12 Apr 2025 07:27:23 +0000 (10:27 +0300)
Add a test case to simulate rejection of all links other than the one
where association is requested in an ML association and verify
successful connection on accepted links.

Signed-off-by: Rameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
src/ap/ieee802_11.c
tests/hwsim/test_eht.py

index f57b1619a9bd40b828fbd7f9fd11040950414c6a..0cca68c1c7b1c77db53bf2965a8b086e06318cc0 100644 (file)
@@ -4794,7 +4794,7 @@ static int ieee80211_ml_process_link(struct hostapd_data *hapd,
        }
 
        sta = ap_get_sta(hapd, origin_sta->addr);
-       if (sta) {
+       if (sta || TEST_FAIL()) {
                wpa_printf(MSG_INFO, "MLD: link: Station already exists");
                status = WLAN_STATUS_UNSPECIFIED_FAILURE;
                sta = NULL;
index 987938d05e289b8f328d4534becaddc65d4ee4fd..3cec968d743d47d2fb5ccd5285c4a95ee1771f60 100644 (file)
@@ -1055,6 +1055,44 @@ def test_eht_all_links_rejected(dev, apdev, params):
             # connects.
             wpas.wait_connected(timeout=15)
 
+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), \
+        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("mld_connect_bssid_pref", "00:11:22:33:44:01")
+        wpas.set("sae_pwe", "1")
+
+        connected = False
+        with fail_test(hapd0, 1, "ieee80211_ml_process_link"):
+            wpas.connect(ssid, sae_password=passphrase, ieee80211w="2",
+                         key_mgmt="SAE", scan_freq="2412", wait_connect=False)
+            ev = wpas.wait_event(['CTRL-EVENT-CONNECTED',
+                                  'CTRL-EVENT-DISCONNECTED'])
+            if ev and 'CTRL-EVENT-CONNECTED' in ev:
+                connected = True
+        if not connected:
+            raise Exception('Connection failure')
+
+        eht_verify_wifi_version(wpas)
+        eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+                          valid_links=1, active_links=1)
+        traffic_test(wpas, hapd0)
+
 def test_eht_connect_invalid_link(dev, apdev, params):
     """EHT MLD AP where one link is incorrectly configured and rejected by mac80211"""
     with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \