]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Add helper function to get non-TX BSS based on MBSSID index
authorRameshkumar Sundaram <rameshkumar.sundaram@oss.qualcomm.com>
Thu, 9 Oct 2025 11:18:48 +0000 (16:48 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 13 Oct 2025 20:07:54 +0000 (23:07 +0300)
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 <rameshkumar.sundaram@oss.qualcomm.com>
Signed-off-by: Manish Dharanenthiran <manish.dharanenthiran@oss.qualcomm.com>
src/ap/beacon.c
src/ap/hostapd.c
src/ap/hostapd.h

index 0f35e60349a2fca8f232c3b56ad4f08c60d8a869..52e1f714e20f1543ee9e6b5e435a1abe52c24ddf 100644 (file)
@@ -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);
index b5a274e08a2ffbfd195624c40fe47b38fd470ff3..a57a151fa7bbe7481a7bc384c731c45851b32d57 100644 (file)
@@ -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;
+}
index 3f58225e8184e62a83f9d0fffd9fc819a93c01f1..8ee341f764b6d7788a37a9887793af92d38b641c 100644 (file)
@@ -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 */