From: Rameshkumar Sundaram Date: Thu, 9 Oct 2025 11:18:48 +0000 (+0530) Subject: AP MLD: Add helper function to get non-TX BSS based on MBSSID index X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f406756eb45473d3aa3ed80213ef5890e230f7a2;p=thirdparty%2Fhostap.git AP MLD: Add helper function to get non-TX BSS based on MBSSID index During ML Probe Request, a non-AP MLD might specify an AP MLD ID to let the AP MLD know for which non-TX BSS it is requesting information. Currently, while parsing the ML Probe Request frame, partner BSS information is getting used to fetch the non-TX BSS requested by the non-AP MLD. However, relying on the partner information to fetch the non-TX BSS is not correct in all the cases. Hence, remove fetching non-TX BSS from the partner interface list and use MBSSID index received in the Probe Request frame to get requested non-TX BSS data. Address this by adding a new helper function to get the non-TX BSS from the MBSSID index received in the Probe Request frame. Signed-off-by: Rameshkumar Sundaram Signed-off-by: Manish Dharanenthiran --- diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 0f35e6034..52e1f714e 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1088,19 +1088,28 @@ static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd, "MLD: Got ML probe request with AP MLD ID %d for links %04x", mld_id, links); + /* + * Set mld_ap if the ML probe request explicitly requested a specific + * AP MLD ID. + */ + if (mld_id > 0) { + if (hapd == hostapd_mbssid_get_tx_bss(hapd)) { + hapd = hostapd_get_mbssid_bss_by_idx(hapd, mld_id); + if (!hapd) { + wpa_printf(MSG_INFO, + "Ignore Probe Request from " MACSTR + " since no matched non-TX BSS found for MBSSID Index %d", + MAC2STR(mgmt->sa), mld_id); + goto fail; + } + } + params->mld_ap = hapd; + } + for_each_mld_link(link, hapd) { struct mld_link_info *link_info; u8 mld_link_id = link->mld_link_id; - /* - * Set mld_ap iff the ML probe request explicitly - * requested a specific MLD ID. In that case, the targeted - * AP may have been a nontransmitted BSSID on the same - * interface. - */ - if (mld_id != -1 && link->iface == hapd->iface) - params->mld_ap = link; - /* Never duplicate main Probe Response frame body */ if (link == hapd) continue; @@ -1118,7 +1127,7 @@ static void hostapd_fill_probe_resp_ml_params(struct hostapd_data *hapd, mld_link_id, link_info->resp_sta_profile_len); } - if (mld_id != -1 && !params->mld_ap) { + if (mld_id > 0 && !params->mld_ap) { wpa_printf(MSG_DEBUG, "MLD: No nontransmitted BSSID for MLD ID %d", mld_id); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index b5a274e08..a57a151fa 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -5273,3 +5273,13 @@ u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd) return punct_bitmap; } + + +struct hostapd_data * +hostapd_get_mbssid_bss_by_idx(struct hostapd_data *hapd, size_t idx) +{ + if (idx < hapd->iface->num_bss) + return hapd->iface->bss[idx]; + + return NULL; +} diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 3f58225e8..8ee341f76 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -906,4 +906,7 @@ static inline bool ap_pmf_enabled(struct hostapd_bss_config *conf) enum oper_chan_width hostapd_chan_width_from_freq_params(struct hostapd_freq_params *freq_params); +struct hostapd_data * +hostapd_get_mbssid_bss_by_idx(struct hostapd_data *hapd, size_t idx); + #endif /* HOSTAPD_H */