TDLS: Add testing code for concurrent initiation

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.
This commit is contained in:
Jouni Malinen 2011-01-27 21:10:05 +02:00 committed by Jouni Malinen
parent 43291b683c
commit 0c4268eb27

View 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 "