aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/bss.c
diff options
context:
space:
mode:
authorJingxiang Ge <jge@qti.qualcomm.com>2015-08-25 17:31:40 (GMT)
committerJouni Malinen <j@w1.fi>2015-08-26 13:46:28 (GMT)
commit3008d0a6b88de7918b54502dd4b86476535da8b6 (patch)
tree442397c39c9a369b37a66af019c466009ab901e5 /wpa_supplicant/bss.c
parent2ce741fe0f7335dd8a6ca787d3ad95748e0f8d2f (diff)
downloadhostap-3008d0a6b88de7918b54502dd4b86476535da8b6.zip
hostap-3008d0a6b88de7918b54502dd4b86476535da8b6.tar.gz
hostap-3008d0a6b88de7918b54502dd4b86476535da8b6.tar.bz2
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>
Diffstat (limited to 'wpa_supplicant/bss.c')
-rw-r--r--wpa_supplicant/bss.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index e4bde6e..6727c86 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);
}