From 6c699913824eae0ac140a2063a80f1a5136d9ec4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 17 Jan 2015 15:39:48 +0200 Subject: [PATCH] Make wpa_supplicant FLUSH command more likely to clear all BSS entries Move the wpa_bss_flush() call to the end of the function to allow any pending user of a BSS entry to be cleared before removing the unused entries. There were number of cases where BSS entries could have been left in the list and this resulted in some hwsim test failures. Signed-off-by: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index e8b7fb166..70680a1c0 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -6166,8 +6166,6 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->sta_uapsd = 0; wpa_drv_radio_disable(wpa_s, 0); - - wpa_bss_flush(wpa_s); wpa_blacklist_clear(wpa_s); wpa_s->extra_blacklist_count = 0; wpa_supplicant_ctrl_iface_remove_network(wpa_s, "all"); @@ -6202,6 +6200,16 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) wpa_s->disconnected = 0; os_free(wpa_s->next_scan_freqs); wpa_s->next_scan_freqs = NULL; + + wpa_bss_flush(wpa_s); + if (!dl_list_empty(&wpa_s->bss)) { + wpa_printf(MSG_DEBUG, + "BSS table not empty after flush: %u entries, current_bss=%p bssid=" + MACSTR " pending_bssid=" MACSTR, + dl_list_len(&wpa_s->bss), wpa_s->current_bss, + MAC2STR(wpa_s->bssid), + MAC2STR(wpa_s->pending_bssid)); + } } -- 2.47.2