TDLS: Pass peer's AID information to kernel
authorSunil Dutt <duttus@codeaurora.org>
Mon, 6 May 2013 12:47:44 +0000 (15:47 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 6 May 2013 12:47:44 +0000 (15:47 +0300)
The information of the peer's AID is required for the driver to
construct partial AID in VHT PPDU's. Pass this information to the driver
during add/set station operations (well, as soon as the information is
available, i.e., with set station operation currently).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/rsn_supp/tdls.c
src/rsn_supp/wpa.h
src/rsn_supp/wpa_i.h
src/rsn_supp/wpa_ie.c
src/rsn_supp/wpa_ie.h
wpa_supplicant/wpas_glue.c

index 069e22b..441628f 100644 (file)
@@ -127,6 +127,8 @@ struct wpa_tdls_peer {
 
        u8 qos_info;
 
+       u16 aid;
+
        u8 *ext_capab;
        size_t ext_capab_len;
 };
@@ -1558,6 +1560,8 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
 
        peer->qos_info = kde.qosinfo;
 
+       peer->aid = kde.aid;
+
 #ifdef CONFIG_TDLS_TESTING
        if (tdls_testing & TDLS_TESTING_CONCURRENT_INIT) {
                peer = wpa_tdls_add_peer(sm, src_addr, NULL);
@@ -1735,7 +1739,7 @@ skip_rsn:
 
 skip_rsn_check:
        /* add the peer to the driver as a "setup in progress" peer */
-       wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, NULL, 0, NULL, NULL, 0,
+       wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, NULL, 0,
                                NULL, 0);
 
        wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Setup Response / TPK M2");
@@ -1777,7 +1781,8 @@ static int wpa_tdls_enable_link(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
        }
 
        /* add supported rates, capabilities, and qos_info to the TDLS peer */
-       if (wpa_sm_tdls_peer_addset(sm, peer->addr, 0, peer->capability,
+       if (wpa_sm_tdls_peer_addset(sm, peer->addr, 0, peer->aid,
+                                   peer->capability,
                                    peer->supp_rates, peer->supp_rates_len,
                                    peer->ht_capabilities,
                                    peer->vht_capabilities,
@@ -1908,6 +1913,8 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
 
        peer->qos_info = kde.qosinfo;
 
+       peer->aid = kde.aid;
+
        if (!wpa_tdls_get_privacy(sm)) {
                peer->rsnie_p_len = 0;
                peer->cipher = WPA_CIPHER_NONE;
@@ -2235,7 +2242,7 @@ int wpa_tdls_start(struct wpa_sm *sm, const u8 *addr)
        peer->initiator = 1;
 
        /* add the peer to the driver as a "setup in progress" peer */
-       wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, NULL, 0, NULL, NULL, 0,
+       wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL, NULL, 0,
                                NULL, 0);
 
        if (wpa_tdls_send_tpk_m1(sm, peer) < 0) {
index d4533a8..78dfb52 100644 (file)
@@ -56,7 +56,7 @@ struct wpa_sm_ctx {
                              u8 action_code, u8 dialog_token,
                              u16 status_code, const u8 *buf, size_t len);
        int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
-       int (*tdls_peer_addset)(void *ctx, const u8 *addr, int add,
+       int (*tdls_peer_addset)(void *ctx, const u8 *addr, int add, u16 aid,
                                u16 capability, const u8 *supp_rates,
                                size_t supp_rates_len,
                                const struct ieee80211_ht_capabilities *ht_capab,
index 877e6de..0e0d373 100644 (file)
@@ -282,7 +282,7 @@ static inline int wpa_sm_tdls_oper(struct wpa_sm *sm, int oper,
 
 static inline int
 wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
-                       u16 capability, const u8 *supp_rates,
+                       u16 aid, u16 capability, const u8 *supp_rates,
                        size_t supp_rates_len,
                        const struct ieee80211_ht_capabilities *ht_capab,
                        const struct ieee80211_vht_capabilities *vht_capab,
@@ -290,7 +290,7 @@ wpa_sm_tdls_peer_addset(struct wpa_sm *sm, const u8 *addr, int add,
 {
        if (sm->ctx->tdls_peer_addset)
                return sm->ctx->tdls_peer_addset(sm->ctx->ctx, addr, add,
-                                                capability, supp_rates,
+                                                aid, capability, supp_rates,
                                                 supp_rates_len, ht_capab,
                                                 vht_capab, qosinfo,
                                                 ext_capab, ext_capab_len);
index 652197f..ba203e6 100644 (file)
@@ -430,6 +430,9 @@ int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
                } else if (*pos == WLAN_EID_HT_CAP) {
                        ie->ht_capabilities = pos + 2;
                        ie->ht_capabilities_len = pos[1];
+               } else if (*pos == WLAN_EID_VHT_AID) {
+                       if (pos[1] >= 2)
+                               ie->aid = WPA_GET_LE16(pos + 2);
                } else if (*pos == WLAN_EID_VHT_CAP) {
                        ie->vht_capabilities = pos + 2;
                        ie->vht_capabilities_len = pos[1];
index 82a5c08..2c78801 100644 (file)
@@ -54,6 +54,7 @@ struct wpa_eapol_ie_parse {
        const u8 *vht_capabilities;
        size_t vht_capabilities_len;
        u8 qosinfo;
+       u16 aid;
 };
 
 int wpa_supplicant_parse_ies(const u8 *buf, size_t len,
index cd51873..faaf492 100644 (file)
@@ -551,7 +551,7 @@ static int wpa_supplicant_tdls_oper(void *ctx, int oper, const u8 *peer)
 
 
 static int wpa_supplicant_tdls_peer_addset(
-       void *ctx, const u8 *peer, int add, u16 capability,
+       void *ctx, const u8 *peer, int add, u16 aid, u16 capability,
        const u8 *supp_rates, size_t supp_rates_len,
        const struct ieee80211_ht_capabilities *ht_capab,
        const struct ieee80211_vht_capabilities *vht_capab,
@@ -563,7 +563,7 @@ static int wpa_supplicant_tdls_peer_addset(
        os_memset(&params, 0, sizeof(params));
 
        params.addr = peer;
-       params.aid = 1;
+       params.aid = add ? 1 : aid;
        params.capability = capability;
        params.flags = WPA_STA_TDLS_PEER | WPA_STA_AUTHORIZED;