aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/scan.c
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2015-11-17 13:08:23 (GMT)
committerJouni Malinen <j@w1.fi>2015-11-30 12:03:28 (GMT)
commit09ea4309b65594e169f462744fda6f82ff89774f (patch)
treec37cdf5dcd5df648ce5b838de759738ea19b709a /wpa_supplicant/scan.c
parentf0154bf4347f0277e683c5666ff86fc9a0f0ce8c (diff)
downloadhostap-09ea4309b65594e169f462744fda6f82ff89774f.zip
hostap-09ea4309b65594e169f462744fda6f82ff89774f.tar.gz
hostap-09ea4309b65594e169f462744fda6f82ff89774f.tar.bz2
nl80211: Add support for multiple scan plans for scheduled scan
Add 'scan plans' to driver scan parameters for scheduled scan. Each 'scan plan' specifies the number of iterations to run the scan request and the interval between iterations. When a scan plan finishes (i.e., it was run for the specified number of iterations), the next scan plan is executed. The last scan plan will run infinitely. The maximum number of supported scan plans, the maximum number of iterations for a single scan plan and the maximum scan interval are advertised by the driver. Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Diffstat (limited to 'wpa_supplicant/scan.c')
-rw-r--r--wpa_supplicant/scan.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index a39922f..25a1011 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -271,14 +271,23 @@ int wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
int interval)
{
int ret;
+ struct sched_scan_plan scan_plan = {
+ .interval = interval,
+ .iterations = 0,
+ };
+
+ params->sched_scan_plans = &scan_plan;
+ params->sched_scan_plans_num = 1;
wpa_supplicant_notify_scanning(wpa_s, 1);
- ret = wpa_drv_sched_scan(wpa_s, params, interval * 1000);
+ ret = wpa_drv_sched_scan(wpa_s, params);
if (ret)
wpa_supplicant_notify_scanning(wpa_s, 0);
else
wpa_s->sched_scanning = 1;
+ params->sched_scan_plans = NULL;
+ params->sched_scan_plans_num = 0;
return ret;
}
@@ -2217,6 +2226,19 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src)
params->only_new_results = src->only_new_results;
params->low_priority = src->low_priority;
+ if (src->sched_scan_plans_num > 0) {
+ params->sched_scan_plans =
+ os_malloc(sizeof(*src->sched_scan_plans) *
+ src->sched_scan_plans_num);
+ if (!params->sched_scan_plans)
+ goto failed;
+
+ os_memcpy(params->sched_scan_plans, src->sched_scan_plans,
+ sizeof(*src->sched_scan_plans) *
+ src->sched_scan_plans_num);
+ params->sched_scan_plans_num = src->sched_scan_plans_num;
+ }
+
if (src->mac_addr_rand) {
params->mac_addr_rand = src->mac_addr_rand;
@@ -2254,6 +2276,7 @@ void wpa_scan_free_params(struct wpa_driver_scan_params *params)
os_free((u8 *) params->extra_ies);
os_free(params->freqs);
os_free(params->filter_ssids);
+ os_free(params->sched_scan_plans);
/*
* Note: params->mac_addr_mask points to same memory allocation and