]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Ignore scan results from ongoing scan when FLUSH command is issued
authorJouni Malinen <j@w1.fi>
Sat, 10 Dec 2016 17:00:47 +0000 (19:00 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 11 Dec 2016 10:45:08 +0000 (12:45 +0200)
This makes wpa_supplicant behavior more consistent with FLUSH command to
clear all state. Previously, it was possible for an ongoing scan to be
aborted when the FLUSH command is issued and the scan results from that
aborted scan would still be processed and that would update the BSS
table which was supposed to cleared by the FLUSH command.

This could result in hwsim test case failures due to unexpected BSS
table entries being present after the FLUSH command.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/events.c
wpa_supplicant/scan.c
wpa_supplicant/wpa_supplicant_i.h

index c504b6f37a3508b552ab075399903df6809cfd07..05d1f7b8c9f7587d5e4d3244d647197730fde941 100644 (file)
@@ -7188,7 +7188,8 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
 
        wpa_dbg(wpa_s, MSG_DEBUG, "Flush all wpa_supplicant state");
 
-       wpas_abort_ongoing_scan(wpa_s);
+       if (wpas_abort_ongoing_scan(wpa_s) == 0)
+               wpa_s->ignore_post_flush_scan_res = 1;
 
        if (wpa_s->wpa_state >= WPA_AUTHENTICATING) {
                /*
index 67438e53018d71630a6de2cbfa6f748abbf968f4..a57b1dad280eb6f06cb0f3e7aed61b42b709784f 100644 (file)
@@ -1966,6 +1966,8 @@ int wpa_supplicant_fast_associate(struct wpa_supplicant *wpa_s)
 #else /* CONFIG_NO_SCAN_PROCESSING */
        struct os_reltime now;
 
+       wpa_s->ignore_post_flush_scan_res = 0;
+
        if (wpa_s->last_scan_res_used == 0)
                return -1;
 
index 272e633f9a472fbf96be138cd9730ff734d654ce..68dc2f41a39d7dc1a6151dce459955da91113c1a 100644 (file)
@@ -714,6 +714,8 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
        size_t max_ssids;
        int connect_without_scan = 0;
 
+       wpa_s->ignore_post_flush_scan_res = 0;
+
        if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
                wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - interface disabled");
                return;
@@ -2212,6 +2214,16 @@ wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s,
        }
        dump_scan_res(scan_res);
 
+       if (wpa_s->ignore_post_flush_scan_res) {
+               /* FLUSH command aborted an ongoing scan and these are the
+                * results from the aborted scan. Do not process the results to
+                * maintain flushed state. */
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "Do not update BSS table based on pending post-FLUSH scan results");
+               wpa_s->ignore_post_flush_scan_res = 0;
+               return scan_res;
+       }
+
        wpa_bss_update_start(wpa_s);
        for (i = 0; i < scan_res->num; i++)
                wpa_bss_update_scan_res(wpa_s, scan_res->res[i],
index ec6917a7d32f165fdbe8d8b5354bcb750f6a955a..adc3478b1aa6b6196037cc616a81e56b070d171c 100644 (file)
@@ -987,6 +987,7 @@ struct wpa_supplicant {
        unsigned int wmm_ac_supported:1;
        unsigned int ext_work_in_progress:1;
        unsigned int own_disconnect_req:1;
+       unsigned int ignore_post_flush_scan_res:1;
 
 #define MAC_ADDR_RAND_SCAN       BIT(0)
 #define MAC_ADDR_RAND_SCHED_SCAN BIT(1)