aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-09-26 21:09:33 (GMT)
committerJouni Malinen <j@w1.fi>2016-09-26 21:09:33 (GMT)
commit5bb7327a697108c880dd31c9e421df386c904b1a (patch)
tree0bed828263eccf7459d45008e4d4c40110fa3650
parentbe7ebd892ee7c47ff291de4e7802c14758f02a3d (diff)
downloadhostap-5bb7327a697108c880dd31c9e421df386c904b1a.zip
hostap-5bb7327a697108c880dd31c9e421df386c904b1a.tar.gz
hostap-5bb7327a697108c880dd31c9e421df386c904b1a.tar.bz2
Share a common helper function for restarting sched_scan
This code sequence was already used at two different places (and an additional one has been proposed), so add a common helper function to avoid having to copy-paste this functionality in multiple locations. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r--wpa_supplicant/ctrl_iface.c13
-rw-r--r--wpa_supplicant/scan.c9
-rw-r--r--wpa_supplicant/scan.h1
3 files changed, 13 insertions, 10 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 4131833..1b81797 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -8564,10 +8564,7 @@ static int wpas_ctrl_iface_mac_rand_scan(struct wpa_supplicant *wpa_s,
}
} else if (wpa_s->sched_scanning &&
(type & MAC_ADDR_RAND_SCHED_SCAN)) {
- /* simulate timeout to restart the sched scan */
- wpa_s->sched_scan_timed_out = 1;
- wpa_s->prev_sched_ssid = NULL;
- wpa_supplicant_cancel_sched_scan(wpa_s);
+ wpas_scan_restart_sched_scan(wpa_s);
}
return 0;
}
@@ -8593,12 +8590,8 @@ static int wpas_ctrl_iface_mac_rand_scan(struct wpa_supplicant *wpa_s,
wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_SCHED_SCAN,
addr, mask);
- if (wpa_s->sched_scanning && !wpa_s->pno) {
- /* simulate timeout to restart the sched scan */
- wpa_s->sched_scan_timed_out = 1;
- wpa_s->prev_sched_ssid = NULL;
- wpa_supplicant_cancel_sched_scan(wpa_s);
- }
+ if (wpa_s->sched_scanning && !wpa_s->pno)
+ wpas_scan_restart_sched_scan(wpa_s);
}
if (type & MAC_ADDR_RAND_PNO) {
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 24d6080..60e7b68 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -2745,3 +2745,12 @@ void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s)
wpa_supplicant_cancel_sched_scan(wpa_s);
}
}
+
+
+void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s)
+{
+ /* simulate timeout to restart the sched scan */
+ wpa_s->sched_scan_timed_out = 1;
+ 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 edc04aa..2aa0a8b 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -45,6 +45,7 @@ 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_scan_restart_sched_scan(struct wpa_supplicant *wpa_s);
void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s,
unsigned int type);