[PATCH 05/18] wpa_supplicant: cancel sched scan on select_network command
andrei.otcheretianski at intel.com
andrei.otcheretianski at intel.com
Mon Sep 5 07:32:58 PDT 2016
From: Max Stepanov <Max.Stepanov at intel.com>
If a scheduled scan is running on select network command,
cancel and reset it before kicking off a regular scan request.
Signed-off-by: Max Stepanov <Max.Stepanov at intel.com>
---
wpa_supplicant/scan.c | 19 +++++++++++++++++++
wpa_supplicant/scan.h | 1 +
wpa_supplicant/wpa_supplicant.c | 1 +
3 files changed, 21 insertions(+)
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 371c16a..e1e2421 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -2726,3 +2726,22 @@ fail:
wpa_printf(MSG_ERROR, "invalid scan plans list");
return -1;
}
+
+
+/**
+ * wpas_scan_reset_sched_scan - reset a sched scan state
+ * @wpa_s: Pointer to wpa_supplicant data
+ *
+ * This function is used to cancel a running scheduled scan and to reset an
+ * internal scan state to continue with a regular scan on the following
+ * wpa_supplicant_req_scan() calls.
+ */
+void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s)
+{
+ wpa_s->normal_scans = 0;
+ if (wpa_s->sched_scanning) {
+ wpa_s->sched_scan_timed_out = 0;
+ wpa_s->prev_sched_ssid = NULL;
+ wpa_supplicant_cancel_sched_scan(wpa_s);
+ }
+}
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index b2bb386..edc04aa 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -44,6 +44,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src);
void wpa_scan_free_params(struct wpa_driver_scan_params *params);
int wpas_start_pno(struct wpa_supplicant *wpa_s);
int wpas_stop_pno(struct wpa_supplicant *wpa_s);
+void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s);
void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s,
unsigned int type);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5bb1f72..f9dc8d2 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3001,6 +3001,7 @@ void wpa_supplicant_select_network(struct wpa_supplicant *wpa_s,
if (wpa_s->connect_without_scan ||
wpa_supplicant_fast_associate(wpa_s) != 1) {
wpa_s->scan_req = NORMAL_SCAN_REQ;
+ wpas_scan_reset_sched_scan(wpa_s);
wpa_supplicant_req_scan(wpa_s, 0, disconnected ? 100000 : 0);
}
--
1.9.1
More information about the Hostap
mailing list