From: Rameshkumar Sundaram Date: Wed, 8 Oct 2025 03:20:47 +0000 (+0530) Subject: MBSSID: Use probed hostapd context during probe response generation X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebada15ffe66abc98a62b52b1d1ce8e3bfec9a49;p=thirdparty%2Fhostap.git MBSSID: Use probed hostapd context during probe response generation While filling MBSSID elements during Probe Response frame generation, the TX BSS context is passed to hostapd_eid_mbssid() and hostapd_eid_mbssid_len(), but for a Probe Request frame directed to a non-TX BSS, these functions need probed hostapd context as well. Hence, make changes to pass the probed hostapd context while generating Probe Response frames. Signed-off-by: Rameshkumar Sundaram Signed-off-by: Karthik M Signed-off-by: Manish Dharanenthiran --- diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 259582357..0f35e6034 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -738,9 +738,7 @@ static void hostapd_free_probe_resp_params(struct probe_resp_params *params) static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, struct probe_resp_params *params) { -#ifdef CONFIG_IEEE80211BE struct hostapd_data *hapd_probed = hapd; -#endif /* CONFIG_IEEE80211BE */ size_t buflen = 0; hapd = hostapd_mbssid_get_tx_bss(hapd); @@ -796,7 +794,8 @@ static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, } #endif /* CONFIG_IEEE80211BE */ - buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL, + buflen += hostapd_eid_mbssid_len(hapd_probed, WLAN_FC_STYPE_PROBE_RESP, + NULL, params->known_bss, params->known_bss_len, NULL); buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP, true); @@ -815,9 +814,7 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, struct probe_resp_params *params, u8 *pos, size_t len) { -#ifdef CONFIG_IEEE80211BE struct hostapd_data *hapd_probed = hapd; -#endif /* CONFIG_IEEE80211BE */ u8 *csa_pos; u8 *epos; @@ -857,7 +854,8 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, pos = hostapd_get_rsne(hapd, pos, epos - pos); pos = hostapd_eid_bss_load(hapd, pos, epos - pos); - pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0, + pos = hostapd_eid_mbssid(hapd_probed, pos, epos, + WLAN_FC_STYPE_PROBE_RESP, 0, NULL, params->known_bss, params->known_bss_len, NULL, NULL, NULL, 0); pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 52547bfc0..75c085383 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -8690,10 +8690,11 @@ static size_t hostapd_eid_mbssid_elem_len(struct hostapd_data *hapd, } -size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, +size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd_probed, u32 frame_type, u8 *elem_count, const u8 *known_bss, size_t known_bss_len, size_t *rnr_len) { + struct hostapd_data *hapd = hostapd_mbssid_get_tx_bss(hapd_probed); size_t len = 0, bss_index = 1; if (!hapd->iconf->mbssid || hapd->iface->num_bss <= 1 || @@ -8713,7 +8714,7 @@ size_t hostapd_eid_mbssid_len(struct hostapd_data *hapd, u32 frame_type, while (bss_index < hapd->iface->num_bss) { size_t rnr_count = bss_index; - len += hostapd_eid_mbssid_elem_len(hapd, frame_type, + len += hostapd_eid_mbssid_elem_len(hapd_probed, frame_type, &bss_index, known_bss, known_bss_len); @@ -8875,12 +8876,13 @@ static u8 * hostapd_eid_mbssid_elem(struct hostapd_data *hapd, u8 *eid, u8 *end, } -u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, +u8 * hostapd_eid_mbssid(struct hostapd_data *hapd_probed, u8 *eid, u8 *end, unsigned int frame_stype, u8 elem_count, u8 **elem_offset, const u8 *known_bss, size_t known_bss_len, u8 *rnr_eid, u8 *rnr_count, u8 **rnr_offset, size_t rnr_len) { + struct hostapd_data *hapd = hostapd_mbssid_get_tx_bss(hapd_probed); size_t bss_index = 1, cur_len = 0; u8 elem_index = 0, *rnr_start_eid = rnr_eid; bool add_rnr; @@ -8913,7 +8915,8 @@ u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, elem_offset[elem_index] = eid; elem_index = elem_index + 1; } - eid = hostapd_eid_mbssid_elem(hapd, eid, end, frame_stype, + eid = hostapd_eid_mbssid_elem(hapd_probed, eid, end, + frame_stype, hostapd_max_bssid_indicator(hapd), &bss_index, elem_count, known_bss, known_bss_len);