]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
TDLS: Add testing code for concurrent initiation
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 27 Jan 2011 19:10:05 +0000 (21:10 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 6 Mar 2011 12:54:39 +0000 (14:54 +0200)
tdls_testing 0x80 can now be used to request wpa_supplicant to send
a TDLS Setup Request frame (i.e., try to initiate TDLS setup)
whenever a TDLS Setup Request frame has been received from a peer.

src/rsn_supp/tdls.c

index db423e3093d2651035b4378e1e3d749aba6badd5..73125eddf027f86996f6fc277949b3b369a599ab 100644 (file)
@@ -35,6 +35,7 @@
 #define TDLS_TESTING_WRONG_LIFETIME_RESP BIT(4)
 #define TDLS_TESTING_WRONG_LIFETIME_CONF BIT(5)
 #define TDLS_TESTING_LONG_LIFETIME BIT(6)
+#define TDLS_TESTING_CONCURRENT_INIT BIT(7)
 unsigned int tdls_testing = 0;
 #endif /* CONFIG_TDLS_TESTING */
 
@@ -1202,6 +1203,27 @@ static int wpa_tdls_process_tpk_m1(struct wpa_sm *sm, const u8 *src_addr,
        wpa_printf(MSG_DEBUG, "TDLS: TPK M1 - TPK initiator " MACSTR,
                   MAC2STR(src_addr));
 
+#ifdef CONFIG_TDLS_TESTING
+       if (tdls_testing & TDLS_TESTING_CONCURRENT_INIT) {
+               for (peer = sm->tdls; peer; peer = peer->next) {
+                       if (os_memcmp(peer->addr, src_addr, ETH_ALEN) == 0)
+                               break;
+               }
+               if (peer == NULL) {
+                       peer = os_zalloc(sizeof(*peer));
+                       if (peer == NULL)
+                               goto error;
+                       os_memcpy(peer->addr, src_addr, ETH_ALEN);
+                       peer->next = sm->tdls;
+                       sm->tdls = peer;
+               }
+               wpa_printf(MSG_DEBUG, "TDLS: Testing concurrent initiation of "
+                          "TDLS setup - send own request");
+               peer->initiator = 1;
+               wpa_tdls_send_tpk_m1(sm, peer);
+       }
+#endif /* CONFIG_TDLS_TESTING */
+
        if (!wpa_tdls_get_privacy(sm)) {
                if (kde.rsn_ie) {
                        wpa_printf(MSG_INFO, "TDLS: RSN IE in TPK M1 while "