From 44177b69e8854177044aad4c57cf9cce8269b306 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 2 Dec 2014 19:42:23 +0200 Subject: [PATCH] Allow a BSS entry with all-zeros BSSID to expire 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 --- wpa_supplicant/bss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 055aef071..179843964 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -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)); }