WPS: Fix WPS-in-search check when STA_AUTOCONNECT is disabled

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>
This commit is contained in:
Jouni Malinen 2014-09-27 22:41:28 +03:00
parent e5fdc05dce
commit 6e252b0db3

View file

@ -2159,10 +2159,12 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
} }
if (!wpa_s->disconnected && if (!wpa_s->disconnected &&
(!wpa_s->auto_reconnect_disabled || (!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 " 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, wpa_s->key_mgmt == WPA_KEY_MGMT_WPS,
wpas_wps_searching(wpa_s),
wpa_s->wpa_state); wpa_s->wpa_state);
if (wpa_s->wpa_state == WPA_COMPLETED && if (wpa_s->wpa_state == WPA_COMPLETED &&
wpa_s->current_ssid && wpa_s->current_ssid &&