[PATCH] wpa_supplicant: cancel sched scan on all interfaces

Ilan Peer ilan.peer
Sun Nov 3 05:22:01 PST 2013


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

Cancel sched scan on all interfaces (that share the same radio)
to enable scanning on one interfaces when there is a scheduled
scan on another interface.

Signed-hostap: David Spinadel <david.spinadel at intel.com>

---
 wpa_supplicant/scan.c |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index cfac768..0549656 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1230,16 +1230,43 @@ void wpa_supplicant_cancel_delayed_sched_scan(struct wpa_supplicant *wpa_s)
  * wpa_supplicant_cancel_sched_scan - Stop running scheduled scans
  * @wpa_s: Pointer to wpa_supplicant data
  *
- * This function is used to stop a periodic scheduled scan.
+ * This function is used to stop a periodic scheduled scan on all interfaces
+ * that share the same radio.
  */
 void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s)
 {
+	struct wpa_supplicant *iface;
+	const char *rn, *rn2;
+
 	if (!wpa_s->sched_scanning)
 		return;
 
 	wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling sched scan");
 	eloop_cancel_timeout(wpa_supplicant_sched_scan_timeout, wpa_s, NULL);
 	wpa_supplicant_stop_sched_scan(wpa_s);
+
+	/* Cancel scheduled scan on other interfaces */
+	if (!wpa_s->driver->get_radio_name)
+		return;
+
+	rn = wpa_s->driver->get_radio_name(wpa_s->drv_priv);
+
+	if (!rn || rn[0] == '\0')
+		return;
+
+	for (iface = wpa_s->global->ifaces; iface; iface = iface->next) {
+		if (iface == wpa_s || !iface->driver->get_radio_name)
+			continue;
+
+		rn2 = iface->driver->get_radio_name(iface->drv_priv);
+		if (!rn2 || os_strcmp(rn, rn2) != 0)
+			continue;
+
+		eloop_cancel_timeout(wpa_supplicant_sched_scan_timeout, iface,
+				     NULL);
+		wpa_supplicant_stop_sched_scan(iface);
+	}
+
 }
 
 
-- 
1.7.10.4




More information about the Hostap mailing list