[PATCH v2] hostapd: Disable VHT caps for STAs when no valid VHT MCS found

Rajkumar Manoharan rmanohar
Sat Feb 28 00:43:05 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 | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index 159693f..60c9ee1 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -93,6 +93,11 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
 u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 		       const u8 *vht_capab, size_t vht_capab_len)
 {
+	struct hostapd_hw_modes *mode = hapd->iface->current_mode;
+	struct ieee80211_vht_capabilities *vht_cap, ap_vht_cap;
+	u16 sta_rx_mcs_set, ap_tx_mcs_set;
+	int i, valid_mcs = 0;
+
 	/* Disable VHT caps for STAs associated to no-VHT BSSes. */
 	if (!vht_capab ||
 	    vht_capab_len < sizeof(struct ieee80211_vht_capabilities) ||
@@ -103,6 +108,36 @@ u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
 		return WLAN_STATUS_SUCCESS;
 	}
 
+	/* 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 *)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;
+	}
+
+	if (!valid_mcs) {
+		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