TDLS: Fix higher/lower MAC address check for concurrent init

The logic here was reversed: the STA with lower MAC address is the
one that continues as the initiator.
This commit is contained in:
Jouni Malinen 2011-01-27 21:08:50 +02:00 committed by Jouni Malinen
parent a8b2c2d657
commit 43291b683c

View file

@ -1302,28 +1302,23 @@ skip_rsn:
} }
/* /*
* An entry is already present, so check if a TPK M1 Request * An entry is already present, so check if we already sent a
* had been sent. * TDLS Setup Request. If so, compare MAC addresses and let the
* If so compare MAC address and let * STA with the lower MAC address continue as the initiator.
* - greater MAC continue to be initiator * The other negotiation is terminated.
* - other MAC be Peer and process the Req.
*/ */
if (peer->initiator) { if (peer->initiator) {
if (os_memcmp(sm->own_addr, src_addr, ETH_ALEN) > 0) { if (os_memcmp(sm->own_addr, src_addr, ETH_ALEN) < 0) {
wpa_printf(MSG_DEBUG, "TDLS: Dropping Request " wpa_printf(MSG_DEBUG, "TDLS: Discard request "
"from peer with smaller address " "from peer with higher address "
MACSTR, MAC2STR(src_addr)); MACSTR, MAC2STR(src_addr));
return -1; return -1;
} else { } else {
/* wpa_printf(MSG_DEBUG, "TDLS: Accept request "
* If smaller node then accept the packet, "from peer with lower address "
* clear values and get ready to process this MACSTR " (terminate previously "
* Req. "initiated negotiation",
*/
wpa_printf(MSG_DEBUG, "TDLS: Accepting "
"Request from peer " MACSTR,
MAC2STR(src_addr)); MAC2STR(src_addr));
/* clear sm info and preserve the list */
wpa_tdls_peer_free(sm, peer); wpa_tdls_peer_free(sm, peer);
} }
} }