#include "dfs.h"
-u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid, u32 nsts)
+static struct hostapd_hw_modes *
+mode_for_vht_capab(struct hostapd_data *hapd, struct hostapd_hw_modes *mode)
{
- struct ieee80211_vht_capabilities *cap;
- struct hostapd_hw_modes *mode = hapd->iface->current_mode;
- u8 *pos = eid;
-
- if (!mode || is_6ghz_op_class(hapd->iconf->op_class))
- return eid;
-
if (mode->mode == HOSTAPD_MODE_IEEE80211G && hapd->conf->vendor_vht &&
mode->vht_capab == 0 && hapd->iface->hw_features) {
int i;
for (i = 0; i < hapd->iface->num_hw_features; i++) {
if (hapd->iface->hw_features[i].mode ==
- HOSTAPD_MODE_IEEE80211A) {
- mode = &hapd->iface->hw_features[i];
- break;
- }
+ HOSTAPD_MODE_IEEE80211A)
+ return &hapd->iface->hw_features[i];
}
}
+ return mode;
+}
+
+
+u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid, u32 nsts)
+{
+ struct ieee80211_vht_capabilities *cap;
+ struct hostapd_hw_modes *mode = hapd->iface->current_mode;
+ u8 *pos = eid;
+
+ if (!mode || is_6ghz_op_class(hapd->iconf->op_class))
+ return eid;
+
+ mode = mode_for_vht_capab(hapd, mode);
+
*pos++ = WLAN_EID_VHT_CAP;
*pos++ = sizeof(*cap);
}
-static int check_valid_vht_mcs(struct hostapd_hw_modes *mode,
+static int check_valid_vht_mcs(struct hostapd_data *hapd,
const u8 *sta_vht_capab)
{
+ struct hostapd_hw_modes *mode = hapd->iface->current_mode;
const struct ieee80211_vht_capabilities *vht_cap;
struct ieee80211_vht_capabilities ap_vht_cap;
u16 sta_rx_mcs_set, ap_tx_mcs_set;
if (!mode)
return 1;
+ mode = mode_for_vht_capab(hapd, mode);
/*
* Disable VHT caps for STAs for which there is not even a single
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)
+ if (((ap_tx_mcs_set >> (i * 2)) & 0x3) == 3)
continue;
- if ((sta_rx_mcs_set & (0x3 << (i * 2))) == 3)
+ if (((sta_rx_mcs_set >> (i * 2)) & 0x3) == 3)
continue;
return 1;
/* Disable VHT caps for STAs associated to no-VHT BSSes. */
if (!vht_capab || !(sta->flags & WLAN_STA_WMM) ||
!hapd->iconf->ieee80211ac || hapd->conf->disable_11ac ||
- !check_valid_vht_mcs(hapd->iface->current_mode, vht_capab) ||
+ !check_valid_vht_mcs(hapd, vht_capab) ||
!(sta->flags & WLAN_STA_HT)) {
sta->flags &= ~WLAN_STA_VHT;
os_free(sta->vht_capabilities);