]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Delay scan request on select_network if disconnecting
authorJouni Malinen <j@w1.fi>
Sat, 4 Feb 2012 10:28:16 +0000 (12:28 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Feb 2012 10:28:16 +0000 (12:28 +0200)
The disconnection command results in disassociation and deauthentication
events which were previously processed during the scan in case of
select_network command being used while associated with another network.
While this works in most cases, it can result in confusing event
messages in ctrl_iface and debug log. Avoid this by using a short delay
between the disconnection and scan request to allow the disconnection
events to be processed prior to starting the new scan.

Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1

wpa_supplicant/wpa_supplicant.c

index 4d3e30735329fc069f9e7ccd3f0584b0796f9d60..9acc89a75e21faceb6575a366e71ea92ab8121a5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * WPA Supplicant
- * Copyright (c) 2003-2011, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2003-2012, Jouni Malinen <j@w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -1667,10 +1667,13 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
 {
 
        struct wpa_ssid *other_ssid;
+       int disconnected = 0;
 
-       if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid)
+       if (ssid && ssid != wpa_s->current_ssid && wpa_s->current_ssid) {
                wpa_supplicant_disassociate(
                        wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+               disconnected = 1;
+       }
 
        /*
         * Mark all other networks disabled or mark all networks enabled if no
@@ -1698,7 +1701,7 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
        wpa_s->connect_without_scan = NULL;
        wpa_s->disconnected = 0;
        wpa_s->reassociate = 1;
-       wpa_supplicant_req_scan(wpa_s, 0, 0);
+       wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0);
 
        if (ssid)
                wpas_notify_network_selected(wpa_s, ssid);