]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_supplicant: Don't exit scanning state on config reload
authorMichal Kazior <michal@plume.com>
Fri, 12 Feb 2021 13:27:54 +0000 (13:27 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 13 Feb 2021 21:12:38 +0000 (23:12 +0200)
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 <michal@plume.com>
wpa_supplicant/wpa_supplicant.c

index a65ca7b1e48c8ce2ca38e06cb55c3c539f7556cf..9badce31887f8bcbfbec9fd5884a69f391726466 100644 (file)
@@ -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);