VHT: Store VHT capabilities and manage VHT flag for STAs
authorMahesh Palivela <maheshp@posedge.com>
Fri, 10 Aug 2012 16:49:18 +0000 (19:49 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 10 Aug 2012 16:49:18 +0000 (19:49 +0300)
Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

src/ap/ieee802_11.c
src/ap/ieee802_11.h
src/ap/ieee802_11_vht.c
src/ap/sta_info.h

index 3996c90..fcbd34f 100644 (file)
@@ -648,6 +648,13 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
        }
 #endif /* CONFIG_IEEE80211N */
 
+#ifdef CONFIG_IEEE80211AC
+       resp = copy_sta_vht_capab(hapd, sta, elems.vht_capabilities,
+                                 elems.vht_capabilities_len);
+       if (resp != WLAN_STATUS_SUCCESS)
+               return resp;
+#endif /* CONFIG_IEEE80211AC */
+
        if ((hapd->conf->wpa & WPA_PROTO_RSN) && elems.rsn_ie) {
                wpa_ie = elems.rsn_ie;
                wpa_ie_len = elems.rsn_ie_len;
index 9993bee..1e5800d 100644 (file)
@@ -56,6 +56,8 @@ void hostapd_get_ht_capab(struct hostapd_data *hapd,
 u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
                      const u8 *ht_capab, size_t ht_capab_len);
 void update_ht_state(struct hostapd_data *hapd, struct sta_info *sta);
+u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
+                      const u8 *vht_capab, size_t vht_capab_len);
 void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
                       const u8 *buf, size_t len, int ack);
 void hostapd_eapol_tx_status(struct hostapd_data *hapd, const u8 *dst,
index 6ba6758..f224288 100644 (file)
@@ -70,3 +70,31 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
 
        return pos;
 }
+
+
+u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta,
+                      const u8 *vht_capab, size_t vht_capab_len)
+{
+       /* Disable VHT caps for STAs associated to no-VHT BSSes. */
+       if (!vht_capab ||
+           vht_capab_len < sizeof(struct ieee80211_vht_capabilities) ||
+           hapd->conf->disable_11ac) {
+               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));
+               if (sta->vht_capabilities == NULL)
+                       return WLAN_STATUS_UNSPECIFIED_FAILURE;
+       }
+
+       sta->flags |= WLAN_STA_VHT;
+       os_memcpy(sta->vht_capabilities, vht_capab,
+                 sizeof(struct ieee80211_vht_capabilities));
+
+       return WLAN_STATUS_SUCCESS;
+}
index cef428d..b5d0f11 100644 (file)
@@ -28,6 +28,7 @@
 #define WLAN_STA_ASSOC_REQ_OK BIT(15)
 #define WLAN_STA_WPS2 BIT(16)
 #define WLAN_STA_GAS BIT(17)
+#define WLAN_STA_VHT BIT(18)
 #define WLAN_STA_PENDING_DISASSOC_CB BIT(29)
 #define WLAN_STA_PENDING_DEAUTH_CB BIT(30)
 #define WLAN_STA_NONERP BIT(31)
@@ -97,6 +98,7 @@ struct sta_info {
        u8 *psk; /* PSK from RADIUS authentication server */
 
        struct ieee80211_ht_capabilities *ht_capabilities;
+       struct ieee80211_vht_capabilities *vht_capabilities;
 
 #ifdef CONFIG_IEEE80211W
        int sa_query_count; /* number of pending SA Query requests;