mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
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>
This commit is contained in:
parent
706e11a485
commit
0e6a2cf282
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user