wpa_supplicant: Reschedule sched scan after network change
Stop sched scan, if running, after any disabling or removing of a network, and request a new scan if needed. Signed-hostap: David Spinadel <david.spinadel@intel.com>
This commit is contained in:
parent
14f7907890
commit
725fc39e07
3 changed files with 37 additions and 1 deletions
|
@ -2216,10 +2216,14 @@ static int wpa_supplicant_ctrl_iface_remove_network(
|
|||
{
|
||||
int id;
|
||||
struct wpa_ssid *ssid;
|
||||
int was_disabled;
|
||||
|
||||
/* cmd: "<network id>" or "all" */
|
||||
if (os_strcmp(cmd, "all") == 0) {
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
|
||||
if (wpa_s->sched_scanning)
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
|
||||
eapol_sm_invalidate_cached_session(wpa_s->eapol);
|
||||
if (wpa_s->current_ssid) {
|
||||
#ifdef CONFIG_SME
|
||||
|
@ -2272,12 +2276,21 @@ static int wpa_supplicant_ctrl_iface_remove_network(
|
|||
WLAN_REASON_DEAUTH_LEAVING);
|
||||
}
|
||||
|
||||
was_disabled = ssid->disabled;
|
||||
|
||||
if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Not able to remove the "
|
||||
"network id=%d", id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!was_disabled && wpa_s->sched_scanning) {
|
||||
wpa_printf(MSG_DEBUG, "Stop ongoing sched_scan to remove "
|
||||
"network from filters");
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1479,6 +1479,7 @@ DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
|
|||
char *iface = NULL, *net_id = NULL;
|
||||
int id;
|
||||
struct wpa_ssid *ssid;
|
||||
int was_disabled;
|
||||
|
||||
dbus_message_get_args(message, NULL, DBUS_TYPE_OBJECT_PATH, &op,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
@ -1505,6 +1506,8 @@ DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
|
|||
goto out;
|
||||
}
|
||||
|
||||
was_disabled = ssid->disabled;
|
||||
|
||||
wpas_notify_network_removed(wpa_s, ssid);
|
||||
|
||||
if (wpa_config_remove_network(wpa_s->conf, id) < 0) {
|
||||
|
@ -1520,6 +1523,13 @@ DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
|
|||
if (ssid == wpa_s->current_ssid)
|
||||
wpa_supplicant_deauthenticate(wpa_s,
|
||||
WLAN_REASON_DEAUTH_LEAVING);
|
||||
else if (!was_disabled && wpa_s->sched_scanning) {
|
||||
wpa_printf(MSG_DEBUG, "Stop ongoing sched_scan to remove "
|
||||
"network from filters");
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
out:
|
||||
os_free(iface);
|
||||
|
@ -1559,6 +1569,9 @@ static void remove_network(void *arg, struct wpa_ssid *ssid)
|
|||
DBusMessage * wpas_dbus_handler_remove_all_networks(
|
||||
DBusMessage *message, struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
if (wpa_s->sched_scanning)
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
|
||||
/* NB: could check for failure and return an error */
|
||||
wpa_config_foreach_network(wpa_s->conf, remove_network, wpa_s);
|
||||
return NULL;
|
||||
|
|
|
@ -1787,6 +1787,9 @@ void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
|
|||
int was_disabled;
|
||||
|
||||
if (ssid == NULL) {
|
||||
if (wpa_s->sched_scanning)
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
|
||||
for (other_ssid = wpa_s->conf->ssid; other_ssid;
|
||||
other_ssid = other_ssid->next) {
|
||||
was_disabled = other_ssid->disabled;
|
||||
|
@ -1812,8 +1815,15 @@ void wpa_supplicant_disable_network(struct wpa_supplicant *wpa_s,
|
|||
|
||||
ssid->disabled = 1;
|
||||
|
||||
if (was_disabled != ssid->disabled)
|
||||
if (was_disabled != ssid->disabled) {
|
||||
wpas_notify_network_enabled_changed(wpa_s, ssid);
|
||||
if (wpa_s->sched_scanning) {
|
||||
wpa_printf(MSG_DEBUG, "Stop ongoing sched_scan "
|
||||
"to remove network from filters");
|
||||
wpa_supplicant_cancel_sched_scan(wpa_s);
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue