diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 280441ed7..6472f4f5c 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -117,7 +117,7 @@ static int pno_start(struct wpa_supplicant *wpa_s) interval = wpa_s->conf->sched_scan_interval ? wpa_s->conf->sched_scan_interval : 10; - ret = wpa_drv_sched_scan(wpa_s, ¶ms, interval * 1000); + ret = wpa_supplicant_start_sched_scan(wpa_s, ¶ms, interval); os_free(params.filter_ssids); if (ret == 0) wpa_s->pno = 1; @@ -131,7 +131,7 @@ static int pno_stop(struct wpa_supplicant *wpa_s) if (wpa_s->pno) { wpa_s->pno = 0; - ret = wpa_drv_stop_sched_scan(wpa_s); + ret = wpa_supplicant_stop_sched_scan(wpa_s); } if (wpa_s->wpa_state == WPA_SCANNING) diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 6d679d2c4..7baacaa6f 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -261,10 +261,9 @@ wpa_supplicant_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx) } -static int -wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s, - struct wpa_driver_scan_params *params, - int interval) +int wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s, + struct wpa_driver_scan_params *params, + int interval) { int ret; @@ -279,7 +278,7 @@ wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s, } -static int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s) +int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s) { int ret; @@ -567,6 +566,16 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) return; } + if (wpa_s->scanning) { + /* + * If we are already in scanning state, we shall reschedule the + * the incoming scan request. + */ + wpa_dbg(wpa_s, MSG_DEBUG, "Already scanning - Reschedule the incoming scan req"); + wpa_supplicant_req_scan(wpa_s, 1, 0); + return; + } + if (!wpa_supplicant_enabled_networks(wpa_s) && wpa_s->scan_req == NORMAL_SCAN_REQ) { wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan"); diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h index 66581a9db..b6fe070e2 100644 --- a/wpa_supplicant/scan.h +++ b/wpa_supplicant/scan.h @@ -39,5 +39,9 @@ void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec); void scan_only_handler(struct wpa_supplicant *wpa_s, struct wpa_scan_results *scan_res); int wpas_scan_scheduled(struct wpa_supplicant *wpa_s); +int wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s, + struct wpa_driver_scan_params *params, + int interval); +int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s); #endif /* SCAN_H */