]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Do not mark BSS entry in use if SSID has changed
authorJingxiang Ge <jge@qti.qualcomm.com>
Tue, 25 Aug 2015 17:31:40 +0000 (20:31 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 26 Aug 2015 13:46:28 +0000 (16:46 +0300)
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 <jouni@qca.qualcomm.com>
wpa_supplicant/bss.c

index e4bde6e5ded213d2e6e864871c04a3a3c0b3bdc1..6727c86e9c131a477af05c82540293e5134047a5 100644 (file)
@@ -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);
 }