wifi: cfg80211: avoid overriding direct/MBSSID BSS with per-STA profile BSS

Avoid overriding BSS information generated from MBSSID or direct source
with BSS information generated from per-STA profile source to avoid
losing actual signal strength and information elements such as RNR and
Basic ML elements.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://patch.msgid.link/20240904030917.3602369-4-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Veerendranath Jakkam 2024-09-04 08:39:17 +05:30 committed by Johannes Berg
parent bff93c89ab
commit 450732abad

View File

@ -2905,6 +2905,9 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
struct element *reporter_rnr = NULL;
struct ieee80211_multi_link_elem *ml_elem;
struct cfg80211_mle *mle;
const struct element *ssid_elem;
const u8 *ssid = NULL;
size_t ssid_len = 0;
u16 control;
u8 ml_common_len;
u8 *new_ie = NULL;
@ -2959,6 +2962,13 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
bss_change_count,
gfp);
ssid_elem = cfg80211_find_elem(WLAN_EID_SSID, tx_data->ie,
tx_data->ielen);
if (ssid_elem) {
ssid = ssid_elem->data;
ssid_len = ssid_elem->datalen;
}
for (i = 0; i < ARRAY_SIZE(mle->sta_prof) && mle->sta_prof[i]; i++) {
const struct ieee80211_neighbor_ap_info *ap_info;
enum nl80211_band band;
@ -3040,6 +3050,23 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
freq = ieee80211_channel_to_freq_khz(ap_info->channel, band);
data.channel = ieee80211_get_channel_khz(wiphy, freq);
/* Skip if BSS entry generated from MBSSID or DIRECT source
* frame data available already.
*/
bss = cfg80211_get_bss(wiphy, data.channel, data.bssid, ssid,
ssid_len, IEEE80211_BSS_TYPE_ANY,
IEEE80211_PRIVACY_ANY);
if (bss) {
struct cfg80211_internal_bss *ibss = bss_from_pub(bss);
if (data.capability == bss->capability &&
ibss->bss_source != BSS_SOURCE_STA_PROFILE) {
cfg80211_put_bss(wiphy, bss);
continue;
}
cfg80211_put_bss(wiphy, bss);
}
if (use_for == NL80211_BSS_USE_FOR_MLD_LINK &&
!(wiphy->flags & WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY)) {
use_for = 0;