[PATCH] Handle disconnect event while scanning for WPS

Robert Chiras robert.chiras
Sat Sep 20 02:15:31 PDT 2014


If we are already connected to an AP and we initiate a WPS connection,
wpa_supplicant will first disconnect from the current AP then initiate a
scan request. The driver, will send us a disconnect event with
ReasonCode 3 (WLAN_REASON_DEAUTH_LEAVING), confirming the disconnection
from te current AP.
If this happens during a WPS connection, when scan results receive, this
disconnect will cause the process to stop.
So, if a disconnect event is received while scanning for WPS connection,
ignore this event and continue with WPS connection.

Change-Id: I9332959a25012426cbb8c5ee035b04269c81b6ed
Signed-off-by: Robert Chiras <robert.chiras at intel.com>
---
 wpa_supplicant/events.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index ba9e083..634e4c6 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1356,8 +1356,16 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 		goto scan_work_done;
 
 	if (wpa_s->disconnected) {
-		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
-		goto scan_work_done;
+		if (wpas_wps_searching(wpa_s)) {
+			/* Received a disconnect while scanning for WPS; ignore it
+			 * and continue with WPS process.
+			 * */
+			wpa_s->disconnected = 0;
+			wpa_s->reassociate = 1;
+		} else {
+			wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+			goto scan_work_done;
+		}
 	}
 
 	if (!wpas_driver_bss_selection(wpa_s) &&
-- 
1.9.1




More information about the Hostap mailing list