From: Pooventhiran G Date: Mon, 16 Jun 2025 11:19:00 +0000 (+0530) Subject: AP MLD: Check if non-AP STA in reconfig add-request already exists X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c40409155ba5ddebf3e223b04d198f9b34877324;p=thirdparty%2Fhostap.git AP MLD: Check if non-AP STA in reconfig add-request already exists As per IEEE P802.11be/D7.0, the non-AP STA requested in ML Setup link reconfiguration for "add" operation should not have the (link) MAC address associated to any non-AP STA which is either affiliated or not to a non-AP MLD on the corresponding AP link affiliated with the AP MLD. Enforce this condition and reject the operation otherwise. Reviewed-by: Rohan Dutta Signed-off-by: Pooventhiran G --- diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c index e7f0b4c03..1c7e74ed4 100644 --- a/src/ap/ieee802_11_eht.c +++ b/src/ap/ieee802_11_eht.c @@ -2033,6 +2033,39 @@ send_resp: } +static int +hostapd_ml_check_sta_entry_by_link_addr_iter(struct hostapd_data *hapd, + struct sta_info *sta, void *ctx) +{ + const u8 *link_addr = ctx; + struct mld_link_info li; + + if (!link_addr) + return 0; + + if (sta->mld_info.mld_sta) { + li = sta->mld_info.links[hapd->mld_link_id]; + if (!li.valid || !ether_addr_equal(li.peer_addr, link_addr)) + return 0; + + wpa_printf(MSG_DEBUG, "MLD: STA with address " MACSTR + " exists for AP (link_id=%u) as a non-AP STA affiliated with non-AP MLD " + MACSTR, MAC2STR(link_addr), + hapd->mld_link_id, MAC2STR(sta->addr)); + return 1; + } + + if (ether_addr_equal(sta->addr, link_addr)) { + wpa_printf(MSG_DEBUG, "MLD: STA with address " MACSTR + " exists for AP (link_id=%u) as a legacy STA", + MAC2STR(link_addr), hapd->mld_link_id); + return 1; + } + + return 0; +} + + /* Returns: * 0 = successful parsing * 1 = per-STA profile (subelement) skipped or rejected @@ -2219,6 +2252,15 @@ hostapd_parse_link_reconf_req_sta_profile(struct hostapd_data *hapd, goto add_to_list; } + /* Check if link address is already used by any connected legacy + * non-AP STA or non-AP STA affiliated with a non-AP MLD. + */ + if (ap_for_each_sta(lhapd, hostapd_ml_check_sta_entry_by_link_addr_iter, + sta_addr)) { + ret = 1; /* Reject this per-STA profile */ + goto add_to_list; + } + status = WLAN_STATUS_SUCCESS; /* IE validations done later */ ret = 0;