From 3008d0a6b88de7918b54502dd4b86476535da8b6 Mon Sep 17 00:00:00 2001 From: Jingxiang Ge Date: Tue, 25 Aug 2015 20:31:40 +0300 Subject: [PATCH] Do not mark BSS entry in use if SSID has changed This allows a BSS entry to be expired if the AP has changed its SSID while maintaining the same BSSID and we are associated with the BSS. Previously, the same BSSID was enough to mark all BSS entries from the BSSID as in use regardless of the SSID and as such, they could remain in the wpa_supplicant BSS table indefinitely as long as the association remaining. Signed-off-by: Jouni Malinen --- wpa_supplicant/bss.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index e4bde6e5d..6727c86e9 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -306,10 +306,18 @@ 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 || - (!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)); + if (bss == wpa_s->current_bss) + return 1; + + if (wpa_s->current_bss && + (bss->ssid_len != wpa_s->current_bss->ssid_len || + os_memcmp(bss->ssid, wpa_s->current_bss->ssid, + bss->ssid_len) != 0)) + return 0; /* SSID has changed */ + + return !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); }