WPS: Fix WPS-in-search check when STA_AUTOCONNECT is disabled
authorJouni Malinen <j@w1.fi>
Sat, 27 Sep 2014 19:41:28 +0000 (22:41 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Sep 2014 08:03:48 +0000 (11:03 +0300)
If "STA_AUTOCONNECT 0" has been used to disable automatic connection on
disconnection event and the driver indicates multiple disconnection
events for the disconnection from the current AP when WPS is started, it
could have been possible to hit a case where wpa_s->disconnected was set
to 1 during WPS processing and the following scan result processing
would stop the operation.

wpa_s->key_mgmt == WPA_KEY_MGMT_WPS check was trying to avoid to skip
autoconnect when WPS was in use, but that does not seem to work anymore.
Fix this by checking through wpas_wps_searching() as well to avoid
setting wpa_s->disconnect = 1 when there is an ongoing WPS operation.

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

index 1a0bc41..cf870c5 100644 (file)
@@ -2159,10 +2159,12 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
        }
        if (!wpa_s->disconnected &&
            (!wpa_s->auto_reconnect_disabled ||
-            wpa_s->key_mgmt == WPA_KEY_MGMT_WPS)) {
+            wpa_s->key_mgmt == WPA_KEY_MGMT_WPS ||
+            wpas_wps_searching(wpa_s))) {
                wpa_dbg(wpa_s, MSG_DEBUG, "Auto connect enabled: try to "
-                       "reconnect (wps=%d wpa_state=%d)",
+                       "reconnect (wps=%d/%d wpa_state=%d)",
                        wpa_s->key_mgmt == WPA_KEY_MGMT_WPS,
+                       wpas_wps_searching(wpa_s),
                        wpa_s->wpa_state);
                if (wpa_s->wpa_state == WPA_COMPLETED &&
                    wpa_s->current_ssid &&