path: root/wpa_supplicant/scan.c
diff options
authorJouni Malinen <j@w1.fi>2016-12-10 17:00:47 (GMT)
committerJouni Malinen <j@w1.fi>2016-12-11 10:45:08 (GMT)
commit6e374bd44d43795c1b9104d6886d9a0f5770f2bf (patch)
tree354aa53ac7f841f5f76e04f32def41d0827ba437 /wpa_supplicant/scan.c
parent79124c7ba15b681216cca308951ac6830321171d (diff)
Ignore scan results from ongoing scan when FLUSH command is issued
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>
Diffstat (limited to 'wpa_supplicant/scan.c')
1 files changed, 12 insertions, 0 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 272e633..68dc2f4 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -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");
@@ -2212,6 +2214,16 @@ wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s,
+ 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;
+ }
for (i = 0; i < scan_res->num; i++)
wpa_bss_update_scan_res(wpa_s, scan_res->res[i],