Allow a BSS entry with all-zeros BSSID to expire
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 2 Dec 2014 17:42:23 +0000 (19:42 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 2 Dec 2014 17:46:58 +0000 (19:46 +0200)
wpa_bss_in_use() used to determine that a BSS with BSSID of
00:00:00:00:00:00 is in use in almost every case since either
wpa_s->bssid or wpa_s->pending_bssid was likely to be cleared. This
could result in a corner case of a BSS entry remaining in the BSS table
indefinitely if one was added there with a (likely bogus) address of
00:00:00:00:00:00. Fix this by ignore wpa_s->bssid and
wpa_s->pending_bssid if the BSSID in the BSS table entry is
00:00:00:00:00:00.

In theory, that address is a valid BSSID, but it is unlikely to be used
in any production AP, so the potential expiration of a BSS entry with
that address during a connection attempt would not be a concern
(especially when a new scan would be enough to recover from that).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/bss.c

index 055aef0..1798439 100644 (file)
@@ -306,8 +306,9 @@ static int wpa_bss_known(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 {
        return bss == wpa_s->current_bss ||
-               os_memcmp(bss->bssid, wpa_s->bssid, ETH_ALEN) == 0 ||
-               os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0;
+               (!is_zero_ether_addr(bss->bssid) &&
+                (os_memcmp(bss->bssid, wpa_s->bssid, ETH_ALEN) == 0 ||
+                 os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0));
 }