aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/events.c
diff options
context:
space:
mode:
authorAyala Beker <ayala.beker@intel.com>2015-12-10 10:56:05 (GMT)
committerJouni Malinen <j@w1.fi>2015-12-17 22:24:52 (GMT)
commit0e6a2cf2829384e9864045fca2e4243cf69c6569 (patch)
treebd46389b40a247f3abbbf60c2e75ee4f7be24500 /wpa_supplicant/events.c
parent706e11a485cef327c4de884664b8e72c8a1e6913 (diff)
downloadhostap-0e6a2cf2829384e9864045fca2e4243cf69c6569.zip
hostap-0e6a2cf2829384e9864045fca2e4243cf69c6569.tar.gz
hostap-0e6a2cf2829384e9864045fca2e4243cf69c6569.tar.bz2
Disconnect before trying to switch to a different network
Previously, when wpa_supplicant received bgscan results with a preferred network, it connected to that network without disconnecting from the previous one. This might result in an inconsistent state of upper layers. Fix this by disconnecting from the current AP before connecting to the new one when the network profile changes and there is an existing connection. Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Diffstat (limited to 'wpa_supplicant/events.c')
-rw-r--r--wpa_supplicant/events.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a7b053d..5e8ebad 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1574,6 +1574,13 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
return 0;
}
+ if (ssid != wpa_s->current_ssid &&
+ wpa_s->wpa_state >= WPA_AUTHENTICATING) {
+ wpa_s->own_disconnect_req = 1;
+ wpa_supplicant_deauthenticate(
+ wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+ }
+
if (wpa_supplicant_connect(wpa_s, selected, ssid) < 0) {
wpa_dbg(wpa_s, MSG_DEBUG, "Connect failed");
return -1;