wifi: mac80211: set conn mode prior to parsing elements in beacon

ieee80211_inform_bss() currently calls ieee802_11_parse_elems to
parse the beacon elements, which internally sets the params->mode
to IEEE80211_CONN_MODE_HIGHEST. This means any S1G specific parsing
is bypassed entirely (in the beacon case it is the shorter TIM)
and the beacon is marked as corrupt:

wlan0: operating as S1G STA
wlan0: associating to AP 0c:bf:74:00:30:fd with corrupt beacon
wlan0: associate with 0c:bf:74:00:30:fd (try 1/3)

In this case, we can simply call ieee802_11_parse_elems_full and
build the params locally (similar to most mlme paths) such that we
can set the conn mode to ensure the S1G specific parsing occurs.
Once this is done, the beacon is no longer considered corrupt:

wlan0: operating as S1G STA
wlan0: associate with 0c:bf:74:00:30:fd (try 1/3)

Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com>
Link: https://patch.msgid.link/20261008030939.474493-3-lachlan.hodges@morsemicro.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Lachlan Hodges 2026-10-08 14:09:39 +11:00 committed by Johannes Berg
parent 8662a5ecd6
commit 44f2345f47

View File

@ -68,6 +68,14 @@ void ieee80211_inform_bss(struct wiphy *wiphy,
struct ieee80211_local *local = wiphy_priv(wiphy);
struct inform_bss_update_data *update_data = data;
struct ieee80211_bss *bss = (void *)cbss->priv;
struct ieee80211_elems_parse_params params = {
.mode = cbss->channel->band == NL80211_BAND_S1GHZ ?
IEEE80211_CONN_MODE_S1G :
IEEE80211_CONN_MODE_HIGHEST,
.start = ies->data,
.len = ies->len,
.link_id = -1,
};
struct ieee80211_rx_status *rx_status;
struct ieee802_11_elems *elems;
int clen, srlen;
@ -76,11 +84,11 @@ void ieee80211_inform_bss(struct wiphy *wiphy,
if (!update_data)
return;
elems = ieee802_11_parse_elems(ies->data, ies->len,
update_data->beacon ?
IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON :
IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP,
NULL);
params.type = update_data->beacon ?
IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON :
IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP;
elems = ieee802_11_parse_elems_full(&params);
if (!elems)
return;