[PATCH 4/8] wpa_supplicant: Disconnect before trying to switch to a different network

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ayala Beker <ayala.beker@xxxxxxxxx>

Currently, when wpa_supplicant receives bgscan results
with a preferred netwrok, it connects 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.

Signed-off-by: Ayala Beker <ayala.beker@xxxxxxxxx>
---
 wpa_supplicant/events.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index a7b053d..192b666 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;
-- 
1.9.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux