[PATCH 1/3] wpa_supplicant: abort scan after removing all networks

david.spinadel at intel.com david.spinadel at intel.com
Mon Oct 29 05:13:39 EDT 2012


From: David Spinadel <david.spinadel at intel.com>

Change-Id: I737848dabed49d961985845f2e86f717c2926f0c
Reviewed-on: http://git-mwg.jer.intel.com/gerrit/3585
Reviewed-by: Jenkins
Tested-by: Jenkins
Reviewed-by: Max Stepanov <Max.Stepanov at intel.com>
Tested-by: Max Stepanov <Max.Stepanov at intel.com>
Signed-off-by: David Spinadel <david.spinadel at intel.com>
---
 wpa_supplicant/ctrl_iface.c             |    7 +++++++
 wpa_supplicant/dbus/dbus_new_handlers.c |    8 ++++++++
 wpa_supplicant/dbus/dbus_old_handlers.c |    5 +++++
 wpa_supplicant/wps_supplicant.c         |    5 +++++
 4 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 0351241..d1a5cf6 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2224,6 +2224,8 @@ static int wpa_supplicant_ctrl_iface_remove_network(
 	/* cmd: "<network id>" or "all" */
 	if (os_strcmp(cmd, "all") == 0) {
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
+		wpa_supplicant_cancel_sched_scan(wpa_s);
+		wpa_supplicant_cancel_scan(wpa_s);
 		ssid = wpa_s->conf->ssid;
 		while (ssid) {
 			struct wpa_ssid *remove_ssid = ssid;
@@ -2281,6 +2283,11 @@ static int wpa_supplicant_ctrl_iface_remove_network(
 		return -1;
 	}
 
+	if (!wpa_s->conf->ssid) {
+		wpa_supplicant_cancel_sched_scan(wpa_s);
+		wpa_supplicant_cancel_scan(wpa_s);
+	}
+
 	return 0;
 }
 
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 00378be..b0f0d0e 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -1525,6 +1525,11 @@ DBusMessage * wpas_dbus_handler_remove_network(DBusMessage *message,
 		wpa_supplicant_deauthenticate(wpa_s,
 					      WLAN_REASON_DEAUTH_LEAVING);
 
+	if (!wpa_s->conf->ssid) {
+		wpa_supplicant_cancel_sched_scan(wpa_s);
+		wpa_supplicant_cancel_scan(wpa_s);
+	}
+
 out:
 	os_free(iface);
 	os_free(net_id);
@@ -1562,6 +1567,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)
 {
+	wpa_supplicant_cancel_sched_scan(wpa_s);
+	wpa_supplicant_cancel_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;
diff --git a/wpa_supplicant/dbus/dbus_old_handlers.c b/wpa_supplicant/dbus/dbus_old_handlers.c
index e217a72..ff60f6e 100644
--- a/wpa_supplicant/dbus/dbus_old_handlers.c
+++ b/wpa_supplicant/dbus/dbus_old_handlers.c
@@ -870,6 +870,11 @@ DBusMessage * wpas_dbus_iface_remove_network(DBusMessage *message,
 					      WLAN_REASON_DEAUTH_LEAVING);
 	reply = wpas_dbus_new_success_reply(message);
 
+	if (!wpa_s->conf->ssid) {
+		wpa_supplicant_cancel_sched_scan(wpa_s);
+		wpa_supplicant_cancel_scan(wpa_s);
+	}
+
 out:
 	os_free(iface);
 	os_free(net_id);
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 41aa5db..87ea320 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -759,6 +759,11 @@ static void wpas_clear_wps(struct wpa_supplicant *wpa_s)
 	}
 
 	wpas_wps_clear_ap_info(wpa_s);
+
+	if (!wpa_s->conf->ssid) {
+		wpa_supplicant_cancel_sched_scan(wpa_s);
+		wpa_supplicant_cancel_scan(wpa_s);
+	}
 }
 
 
-- 
1.7.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the HostAP mailing list