aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-02-04 10:28:16 (GMT)
committerJouni Malinen <j@w1.fi>2012-02-04 10:28:16 (GMT)
commitd93dfbd588eb3c16f4ed1b7af825c9c1c9bf7f6d (patch)
tree99c914a222d467182edf25802e6ce7faeafb81bc
parentc7bce24dc9695ac6b0281b32b92b64dac6967e17 (diff)
downloadhostap-d93dfbd588eb3c16f4ed1b7af825c9c1c9bf7f6d.zip
hostap-d93dfbd588eb3c16f4ed1b7af825c9c1c9bf7f6d.tar.gz
hostap-d93dfbd588eb3c16f4ed1b7af825c9c1c9bf7f6d.tar.bz2
Delay scan request on select_network if disconnecting
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
-rw-r--r--wpa_supplicant/wpa_supplicant.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 4d3e307..9acc89a 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -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);