From 1b45b8d3f6b246ea499633d4e23d6788b4ec352c Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Fri, 12 Feb 2021 13:27:54 +0000 Subject: [PATCH] wpa_supplicant: Don't exit scanning state on config reload There's a chance that prior to config reload being requested a scan work was started. As such forcing wpa_supplicant to WPA_DISCONNECTED was removing any hints that the actual driver is busy with work. That led to wpa_supplicant reporting "Failed to initialize AP scan" over and over again for a few seconds (depending on driver/capabilities) until the untracked scan finished. Cancelling a scan isn't really a solution because there's a bunch of scanning state bits sprinkled across wpa_supplicant structure and they get updated as driver events actually flow in in async manner. As far as I can tell this is only preventing unnecessary warning messages. This doesn't seem like it was crippling any logic per se. Signed-off-by: Michal Kazior --- wpa_supplicant/wpa_supplicant.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index a65ca7b1e..9badce318 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -1099,13 +1099,19 @@ static void wpa_supplicant_terminate(int sig, void *signal_ctx) void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s) { enum wpa_states old_state = wpa_s->wpa_state; + enum wpa_states new_state; + + if (old_state == WPA_SCANNING) + new_state = WPA_SCANNING; + else + new_state = WPA_DISCONNECTED; wpa_s->pairwise_cipher = 0; wpa_s->group_cipher = 0; wpa_s->mgmt_group_cipher = 0; wpa_s->key_mgmt = 0; if (wpa_s->wpa_state != WPA_INTERFACE_DISABLED) - wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + wpa_supplicant_set_state(wpa_s, new_state); if (wpa_s->wpa_state != old_state) wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);