[PATCH v3] hostapd: Disable VHT caps for STAs when no valid VHT MCS found
Rajkumar Manoharan
rmanohar
Sat Feb 28 01:07:31 PST 2015
Disable VHT caps for STAs for which there is not even a single
allowed MCS in any supported number of streams. i.e STA is
advertising 3 (not supported) as VHT MCS rates for all supported
streams.
Signed-off-by: Rajkumar Manoharan <rmanohar at qti.qualcomm.com>
---
src/ap/ieee802_11_vht.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index 159693f..ab781ef 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -89,6 +89,41 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
return pos;
}
+static int check_valid_vht_mcs(struct hostapd_hw_modes *mode,
+ const u8 *sta_vht_capab)
+{
+ struct ieee80211_vht_capabilities *vht_cap, ap_vht_cap;
+ u16 sta_rx_mcs_set, ap_tx_mcs_set;
+ int i, valid_mcs = 0;
+
+ if (!mode)
+ return 0;
+
+ /* Disable VHT caps for STAs for which there is not even a single
+ * allowed MCS in any supported number of streams. i.e STA is
+ * advertising 3 (not supported) as VHT MCS rates for all supported
+ * stream cases.
+ */
+ memcpy(&ap_vht_cap.vht_supported_mcs_set, mode->vht_mcs_set,
+ sizeof(ap_vht_cap.vht_supported_mcs_set));
+ vht_cap = (struct ieee80211_vht_capabilities *)sta_vht_capab;
+
+ /* AP Tx MCS map vs STA Rx MCS map */
+ sta_rx_mcs_set = le_to_host16(vht_cap->vht_supported_mcs_set.rx_map);
+ ap_tx_mcs_set = le_to_host16(ap_vht_cap.vht_supported_mcs_set.tx_map);
+
+ for (i = 0; i < VHT_RX_NSS_MAX_STREAMS; i++) {
+ if ((ap_tx_mcs_set & (0x3 << (i * 2))) == 3)
+ continue;
+
+ if ((sta_rx_mcs_set & (0x3 << (i * 2))) == 3)
+ continue;
+
+ valid_mcs = 1;
+ }
+
+ return valid_mcs;
+}
u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
const u8 *vht_capab, size_t vht_capab_len)
@@ -103,6 +138,13 @@ u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
return WLAN_STATUS_SUCCESS;
}
+ if (!check_valid_vht_mcs(hapd->iface->current_mode, vht_capab)) {
+ sta->flags &= ~WLAN_STA_VHT;
+ os_free(sta->vht_capabilities);
+ sta->vht_capabilities = NULL;
+ return WLAN_STATUS_SUCCESS;
+ }
+
if (sta->vht_capabilities == NULL) {
sta->vht_capabilities =
os_zalloc(sizeof(struct ieee80211_vht_capabilities));
--
2.3.1
More information about the Hostap
mailing list