mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-17 17:43:06 -05:00
wpa_supplicant: Handle enabling of one or all networks equally
Move enabling a network to a separate function. Try to reconnect if not associated to an AP. Abort scheduled scan in any case of a new scan. Signed-hostap: David Spinadel <david.spinadel@intel.com>
This commit is contained in:
parent
7ed52f678b
commit
dca1a51149
@ -1726,6 +1726,24 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
|
|||||||
wpa_supplicant_clear_connection(wpa_s, addr);
|
wpa_supplicant_clear_connection(wpa_s, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wpa_supplicant_enable_one_network(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_ssid *ssid)
|
||||||
|
{
|
||||||
|
if (!ssid || !ssid->disabled || ssid->disabled == 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ssid->disabled = 0;
|
||||||
|
wpas_clear_temp_disabled(wpa_s, ssid, 1);
|
||||||
|
wpas_notify_network_enabled_changed(wpa_s, ssid);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to reassociate since there is no current configuration and a new
|
||||||
|
* network was made available.
|
||||||
|
*/
|
||||||
|
if (!wpa_s->current_ssid)
|
||||||
|
wpa_s->reassociate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wpa_supplicant_enable_network - Mark a configured network as enabled
|
* wpa_supplicant_enable_network - Mark a configured network as enabled
|
||||||
@ -1738,47 +1756,22 @@ void wpa_supplicant_enable_network(struct wpa_supplicant *wpa_s,
|
|||||||
struct wpa_ssid *ssid)
|
struct wpa_ssid *ssid)
|
||||||
{
|
{
|
||||||
struct wpa_ssid *other_ssid;
|
struct wpa_ssid *other_ssid;
|
||||||
int was_disabled;
|
|
||||||
|
|
||||||
if (ssid == NULL) {
|
if (ssid == NULL) {
|
||||||
for (other_ssid = wpa_s->conf->ssid; other_ssid;
|
for (other_ssid = wpa_s->conf->ssid; other_ssid;
|
||||||
other_ssid = other_ssid->next) {
|
other_ssid = other_ssid->next)
|
||||||
if (other_ssid->disabled == 2)
|
wpa_supplicant_enable_one_network(wpa_s, other_ssid);
|
||||||
continue; /* do not change persistent P2P group
|
} else
|
||||||
* data */
|
wpa_supplicant_enable_one_network(wpa_s, ssid);
|
||||||
if (other_ssid == wpa_s->current_ssid &&
|
|
||||||
other_ssid->disabled)
|
|
||||||
wpa_s->reassociate = 1;
|
|
||||||
|
|
||||||
was_disabled = other_ssid->disabled;
|
if (wpa_s->reassociate) {
|
||||||
|
if (wpa_s->sched_scanning) {
|
||||||
other_ssid->disabled = 0;
|
wpa_printf(MSG_DEBUG, "Stop ongoing sched_scan to add "
|
||||||
if (was_disabled)
|
"new network to scan filters");
|
||||||
wpas_clear_temp_disabled(wpa_s, other_ssid, 0);
|
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||||
|
|
||||||
if (was_disabled != other_ssid->disabled)
|
|
||||||
wpas_notify_network_enabled_changed(
|
|
||||||
wpa_s, other_ssid);
|
|
||||||
}
|
|
||||||
if (wpa_s->reassociate)
|
|
||||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
|
||||||
} else if (ssid->disabled && ssid->disabled != 2) {
|
|
||||||
if (wpa_s->current_ssid == NULL) {
|
|
||||||
/*
|
|
||||||
* Try to reassociate since there is no current
|
|
||||||
* configuration and a new network was made available.
|
|
||||||
*/
|
|
||||||
wpa_s->reassociate = 1;
|
|
||||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
was_disabled = ssid->disabled;
|
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||||
|
|
||||||
ssid->disabled = 0;
|
|
||||||
wpas_clear_temp_disabled(wpa_s, ssid, 1);
|
|
||||||
|
|
||||||
if (was_disabled != ssid->disabled)
|
|
||||||
wpas_notify_network_enabled_changed(wpa_s, ssid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user