Make wpa_supplicant FLUSH command more likely to clear all BSS entries
authorJouni Malinen <j@w1.fi>
Sat, 17 Jan 2015 13:39:48 +0000 (15:39 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 17 Jan 2015 13:39:48 +0000 (15:39 +0200)
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 <j@w1.fi>
wpa_supplicant/ctrl_iface.c

index e8b7fb1..70680a1 100644 (file)
@@ -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));
+       }
 }