Parse the new UHR elements in the element parsing utilities. As per spec ieee80211bn D1.0 Section 37.29 Beacon Optimization "A UHR AP shall not include the parameters associated with operating modes currently enabled at the AP defined by UHR in the UHR Operation element or any other element carried in the Beacon frame, except when specified otherwise" For beacon frames UHR operation size check done only for UHR operation parameters not for operation information. Signed-off-by: Karthikeyan Kathirvel --- net/mac80211/ieee80211_i.h | 5 +++++ net/mac80211/mlme.c | 2 ++ net/mac80211/parse.c | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 9d9313eee59f..04f1df209cec 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1826,6 +1826,8 @@ struct ieee802_11_elems { const struct ieee80211_multi_link_elem *ml_epcs; const struct ieee80211_bandwidth_indication *bandwidth_indication; const struct ieee80211_ttlm_elem *ttlm[IEEE80211_TTLM_MAX_CNT]; + const struct ieee80211_uhr_cap_elem *uhr_cap; + const struct ieee80211_uhr_operation *uhr_operation; /* not the order in the psd values is per element, not per chandef */ struct ieee80211_parsed_tpe tpe; @@ -1866,6 +1868,7 @@ struct ieee802_11_elems { struct ieee80211_mle_per_sta_profile *prof; size_t sta_prof_len; + u8 uhr_cap_len; /* whether/which parse error occurred while retrieving these elements */ u8 parse_error; }; @@ -2423,6 +2426,7 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, * @mode: connection mode for parsing * @start: pointer to the elements * @len: length of the elements + * @is_beacon: %true if the elements came from beacon frame * @type: type of the frame the elements came from * (action, probe response, beacon, etc.) * @filter: bitmap of element IDs to filter out while calculating @@ -2442,6 +2446,7 @@ struct ieee80211_elems_parse_params { enum ieee80211_conn_mode mode; const u8 *start; size_t len; + bool is_beacon; u8 type; u64 filter; u32 crc; diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index e56ad4b9330f..73649d57d0c3 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -7400,6 +7400,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, !WARN_ON(ieee80211_vif_is_mld(&sdata->vif)) && ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->link[0].bss)) { parse_params.bss = ifmgd->assoc_data->link[0].bss; + parse_params.is_beacon = true; elems = ieee802_11_parse_elems_full(&parse_params); if (!elems) return; @@ -7470,6 +7471,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link, parse_params.bss = bss_conf->bss; parse_params.filter = care_about_ies; parse_params.crc = ncrc; + parse_params.is_beacon = true; elems = ieee802_11_parse_elems_full(&parse_params); if (!elems) return; diff --git a/net/mac80211/parse.c b/net/mac80211/parse.c index bfc4ecb7a048..ed8411aa8b32 100644 --- a/net/mac80211/parse.c +++ b/net/mac80211/parse.c @@ -189,6 +189,17 @@ ieee80211_parse_extension_element(u32 *crc, elems->ttlm_num++; } break; + case WLAN_EID_EXT_UHR_CAPABILITY: + if (ieee80211_uhr_capa_size_ok(data, len)) { + elems->uhr_cap = data; + elems->uhr_cap_len = len; + } + break; + case WLAN_EID_EXT_UHR_OPERATION: + if (ieee80211_uhr_oper_size_ok(data, len, params->is_beacon)) + elems->uhr_operation = data; + calc_crc = true; + break; } if (crc && calc_crc) @@ -963,6 +974,7 @@ ieee80211_prep_mle_link_parse(struct ieee80211_elems_parse *elems_parse, sub->mode = params->mode; sub->type = params->type; + sub->is_beacon = params->is_beacon; sub->from_ap = params->from_ap; sub->link_id = -1; @@ -1062,6 +1074,7 @@ ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params) sub.mode = params->mode; sub.len = nontx_len; sub.type = params->type; + sub.is_beacon = params->is_beacon; sub.link_id = params->link_id; /* consume the space used for non-transmitted profile */ -- 2.34.1