History

mac80211: mlme: validate peer HE supported rates

We validate that AP has mandatory rates set in HE capabilities. Also we make sure AP is consistent with itself on rates set in HE basic rates required joining the BSS and rates set in HE capabilities.

Mordechay Goodstein committed 4 years ago

Commit 97634ef1 parent 453a2a81 file · +100 −1Browse files

Unified · Split

net/mac80211/mlme.c+100−1
@@ -5006,6 +5006,104 @@ static u8 ieee80211_max_rx_chains(struct ieee80211_sub_if_data *sdata, · 5005 unmodified lines
50065006 return chains;
50075007 }
50085008
5009+static bool
5010+ieee80211_verify_peer_he_mcs_support(struct ieee80211_sub_if_data *sdata,
5011+ const struct cfg80211_bss_ies *ies,
5012+ const struct ieee80211_he_operation *he_op)
5013+{
5014+ const struct element *he_cap_elem;
5015+ const struct ieee80211_he_cap_elem *he_cap;
5016+ struct ieee80211_he_mcs_nss_supp *he_mcs_nss_supp;
5017+ u16 mcs_80_map_tx, mcs_80_map_rx;
5018+ u16 ap_min_req_set;
5019+ int mcs_nss_size;
5020+ int nss;
5021+
5022+ he_cap_elem = cfg80211_find_ext_elem(WLAN_EID_EXT_HE_CAPABILITY,
5023+ ies->data, ies->len);
5024+
5025+ /* invalid HE IE */
5026+ if (!he_cap_elem || he_cap_elem->datalen < 1 + sizeof(*he_cap)) {
5027+ sdata_info(sdata,
5028+ "Invalid HE elem, Disable HE\n");
5029+ return false;
5030+ }
5031+
5032+ /* skip one byte ext_tag_id */
5033+ he_cap = (void *)(he_cap_elem->data + 1);
5034+ mcs_nss_size = ieee80211_he_mcs_nss_size(he_cap);
5035+
5036+ /* invalid HE IE */
5037+ if (he_cap_elem->datalen < 1 + sizeof(*he_cap) + mcs_nss_size) {
5038+ sdata_info(sdata,
5039+ "Invalid HE elem with nss size, Disable HE\n");
5040+ return false;
5041+ }
5042+
5043+ /* mcs_nss is right after he_cap info */
5044+ he_mcs_nss_supp = (void *)(he_cap + 1);
5045+
5046+ mcs_80_map_tx = le16_to_cpu(he_mcs_nss_supp->tx_mcs_80);
5047+ mcs_80_map_rx = le16_to_cpu(he_mcs_nss_supp->rx_mcs_80);
5048+
5049+ /* P802.11-REVme/D0.3
5050+ * 27.1.1 Introduction to the HE PHY
5051+ * ...
5052+ * An HE STA shall support the following features:
5053+ * ...
5054+ * Single spatial stream HE-MCSs 0 to 7 (transmit and receive) in all
5055+ * supported channel widths for HE SU PPDUs
5056+ */
5057+ if ((mcs_80_map_tx & 0x3) == IEEE80211_HE_MCS_NOT_SUPPORTED ||
5058+ (mcs_80_map_rx & 0x3) == IEEE80211_HE_MCS_NOT_SUPPORTED) {
5059+ sdata_info(sdata,
5060+ "Missing mandatory rates for 1 Nss, rx 0x%x, tx 0x%x, disable HE\n",
5061+ mcs_80_map_tx, mcs_80_map_rx);
5062+ return false;
5063+ }
5064+
5065+ if (!he_op)
5066+ return true;
5067+
5068+ ap_min_req_set = le16_to_cpu(he_op->he_mcs_nss_set);
5069+
5070+ /* make sure the AP is consistent with itself
5071+ *
5072+ * P802.11-REVme/D0.3
5073+ * 26.17.1 Basic HE BSS operation
5074+ *
5075+ * A STA that is operating in an HE BSS shall be able to receive and
5076+ * transmit at each of the <HE-MCS, NSS> tuple values indicated by the
5077+ * Basic HE-MCS And NSS Set field of the HE Operation parameter of the
5078+ * MLME-START.request primitive and shall be able to receive at each of
5079+ * the <HE-MCS, NSS> tuple values indicated by the Supported HE-MCS and
5080+ * NSS Set field in the HE Capabilities parameter of the MLMESTART.request
5081+ * primitive
5082+ */
5083+ for (nss = 8; nss > 0; nss--) {
5084+ u8 ap_op_val = (ap_min_req_set >> (2 * (nss - 1))) & 3;
5085+ u8 ap_rx_val;
5086+ u8 ap_tx_val;
5087+
5088+ if (ap_op_val == IEEE80211_HE_MCS_NOT_SUPPORTED)
5089+ continue;
5090+
5091+ ap_rx_val = (mcs_80_map_rx >> (2 * (nss - 1))) & 3;
5092+ ap_tx_val = (mcs_80_map_tx >> (2 * (nss - 1))) & 3;
5093+
5094+ if (ap_rx_val == IEEE80211_HE_MCS_NOT_SUPPORTED ||
5095+ ap_tx_val == IEEE80211_HE_MCS_NOT_SUPPORTED ||
5096+ ap_rx_val < ap_op_val || ap_tx_val < ap_op_val) {
5097+ sdata_info(sdata,
5098+ "Invalid rates for %d Nss, rx %d, tx %d oper %d, disable HE\n",
5099+ nss, ap_rx_val, ap_rx_val, ap_op_val);
5100+ return false;
5101+ }
5102+ }
5103+
5104+ return true;
5105+}
5106+
50095107 static bool
50105108 ieee80211_verify_sta_he_mcs_support(struct ieee80211_sub_if_data *sdata,
50115109 struct ieee80211_supported_band *sband,
@@ -5191,7 +5289,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, · 179 unmodified lines
51915289 }
51925290 }
51935291
5194− if (!ieee80211_verify_sta_he_mcs_support(sdata, sband, he_oper))
5292+ if (!ieee80211_verify_peer_he_mcs_support(sdata, ies, he_oper) ||
5293+ !ieee80211_verify_sta_he_mcs_support(sdata, sband, he_oper))
51955294 ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
51965295 }
51975296

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t