From: Rameshkumar Sundaram Date: Thu, 10 Apr 2025 20:07:50 +0000 (+0530) Subject: tests: Verify AP MLD connection with link rejection X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a92ae2f7ace42197019aa5acf9f775e075a483fb;p=thirdparty%2Fhostap.git tests: Verify AP MLD connection with link rejection 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 --- diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index f57b1619a..0cca68c1c 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -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; diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py index 987938d05..3cec968d7 100644 --- a/tests/hwsim/test_eht.py +++ b/tests/hwsim/test_eht.py @@ -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), \