WPS: Cancel WPS operation also in DISCONNECTED state
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 6 Jun 2012 19:07:11 +0000 (22:07 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 6 Jun 2012 19:07:11 +0000 (22:07 +0300)
It is possible for wpa_state to be WPA_DISCONNECTED when a new scan is
scheduled to be started in the future. If wpas_wps_cancel() gets called
(e.g., through control interface wps_cancel or a P2P group removal)
while in that state, the WPS operation (scan request and special network
block) were not removed. Fix this by clearing the WPS operations both in
WPA_SCANNING and WPA_DISCONNECTED states.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
intended-for: hostap-1

wpa_supplicant/wps_supplicant.c

index 8e671f9..78e1166 100644 (file)
@@ -920,7 +920,8 @@ int wpas_wps_cancel(struct wpa_supplicant *wpa_s)
        }
 #endif /* CONFIG_AP */
 
-       if (wpa_s->wpa_state == WPA_SCANNING) {
+       if (wpa_s->wpa_state == WPA_SCANNING ||
+           wpa_s->wpa_state == WPA_DISCONNECTED) {
                wpa_printf(MSG_DEBUG, "WPS: Cancel operation - cancel scan");
                wpa_supplicant_cancel_scan(wpa_s);
                wpas_clear_wps(wpa_s);