TDLS: Update peer STA as soon as full peer info is available
authorArik Nemtsov <arik@wizery.com>
Wed, 25 Jun 2014 14:41:53 +0000 (17:41 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 29 Jun 2014 10:44:14 +0000 (13:44 +0300)
Update the peer STA with full info sending TDLS Setup Response/Confirm
frames instead of after the full setup exchange. This makes it easier
for some drivers to properly negotiate QoS and HT information on the
direct link.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
src/rsn_supp/tdls.c

index 8808f47..c1d0c62 100644 (file)
@@ -1946,8 +1946,17 @@ skip_rsn:
 
 skip_rsn_check:
        /* add the peer to the driver as a "setup in progress" peer */
-       if (wpa_sm_tdls_peer_addset(sm, peer->addr, 1, 0, 0, NULL, 0, NULL,
-                                   NULL, 0, NULL, 0, NULL, 0, NULL, 0))
+       if (wpa_sm_tdls_peer_addset(sm, peer->addr, 1, peer->aid,
+                                   peer->capability,
+                                   peer->supp_rates, peer->supp_rates_len,
+                                   peer->ht_capabilities,
+                                   peer->vht_capabilities,
+                                   peer->qos_info, peer->ext_capab,
+                                   peer->ext_capab_len,
+                                   peer->supp_channels,
+                                   peer->supp_channels_len,
+                                   peer->supp_oper_classes,
+                                   peer->supp_oper_classes_len))
                goto error;
 
        peer->tpk_in_progress = 1;
@@ -1993,20 +2002,6 @@ static int wpa_tdls_enable_link(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
 #endif /* CONFIG_TDLS_TESTING */
        }
 
-       /* add supported rates, capabilities, and qos_info to the TDLS peer */
-       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,
-                                   peer->qos_info, peer->ext_capab,
-                                   peer->ext_capab_len,
-                                   peer->supp_channels,
-                                   peer->supp_channels_len,
-                                   peer->supp_oper_classes,
-                                   peer->supp_oper_classes_len) < 0)
-               return -1;
-
        if (peer->reconfig_key && wpa_tdls_set_key(sm, peer) < 0) {
                wpa_printf(MSG_INFO, "TDLS: Could not configure key to the "
                           "driver");
@@ -2260,6 +2255,20 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
 skip_rsn:
        peer->dtoken = dtoken;
 
+       /* add supported rates, capabilities, and qos_info to the TDLS peer */
+       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,
+                                   peer->qos_info, peer->ext_capab,
+                                   peer->ext_capab_len,
+                                   peer->supp_channels,
+                                   peer->supp_channels_len,
+                                   peer->supp_oper_classes,
+                                   peer->supp_oper_classes_len) < 0)
+               goto error;
+
        wpa_printf(MSG_DEBUG, "TDLS: Sending TDLS Setup Confirm / "
                   "TPK Handshake Message 3");
        if (wpa_tdls_send_tpk_m3(sm, src_addr, dtoken, lnkid, peer) < 0)
@@ -2425,6 +2434,20 @@ static int wpa_tdls_process_tpk_m3(struct wpa_sm *sm, const u8 *src_addr,
        }
 
 skip_rsn:
+       /* add supported rates, capabilities, and qos_info to the TDLS peer */
+       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,
+                                   peer->qos_info, peer->ext_capab,
+                                   peer->ext_capab_len,
+                                   peer->supp_channels,
+                                   peer->supp_channels_len,
+                                   peer->supp_oper_classes,
+                                   peer->supp_oper_classes_len) < 0)
+               goto error;
+
        if (!peer->tpk_success) {
                /*
                 * Enable Link only when tpk_success is 0, signifying that this