]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
TDLS: Fix TPK M2 processing in concurrent initiation case
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 27 Mar 2013 12:17:23 +0000 (14:17 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 27 Mar 2013 12:29:01 +0000 (14:29 +0200)
If we accept the peer TPK M1 after having sent our TPK M1, we need to
reject TPK M2 from the peer to avoid going through two TDLS setup
exchanges.

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

src/rsn_supp/tdls.c

index bcd924c9231fa17655cf2fa7250f491a442977b1..da56e253c6a97e912f18f7a586c391c982fe225c 100644 (file)
@@ -1807,6 +1807,16 @@ static int wpa_tdls_process_tpk_m2(struct wpa_sm *sm, const u8 *src_addr,
                           "TPK M2: " MACSTR, MAC2STR(src_addr));
                return -1;
        }
+       if (!peer->initiator) {
+               /*
+                * This may happen if both devices try to initiate TDLS at the
+                * same time and we accept the TPK M1 from the peer in
+                * wpa_tdls_process_tpk_m1() and clear our previous state.
+                */
+               wpa_printf(MSG_INFO, "TDLS: We were not the initiator, so "
+                          "ignore TPK M2 from " MACSTR, MAC2STR(src_addr));
+               return -1;
+       }
        wpa_tdls_tpk_retry_timeout_cancel(sm, peer, WLAN_TDLS_SETUP_REQUEST);
 
        if (len < 3 + 2 + 1)