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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jingxiang Ge 2015-08-25 20:31:40 +03:00 committed by Jouni Malinen
parent 2ce741fe0f
commit 3008d0a6b8

View 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) static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
{ {
return bss == wpa_s->current_bss || if (bss == wpa_s->current_bss)
(!is_zero_ether_addr(bss->bssid) && 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->bssid, ETH_ALEN) == 0 ||
os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0)); os_memcmp(bss->bssid, wpa_s->pending_bssid, ETH_ALEN) == 0);
} }