Handle legacy scan interruption of sched_scan/PNO

While starting from PNO start context, the scheduled scan was not
setting the flag wpa_s->scanning. This was resulting in the subsequent
SCAN command to proceed further and send command to nl80211/cfg80211.
The expected behavior of cancelling sched_scan was not happening here.

While sched_scan is in progress and a legacy scan comes on the
cli/socket, the sched_scan is cancelled and normal scan is allowed to
continue. However, sometimes sched_scan cancelled event comes a bit
delayed and we will send out the scan command before the wpa_s->scanning
is cleared. Instead, reschedule the incoming scan req if the
wpa_s->scanning shows that it is still in progress.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
This commit is contained in:
Jithu Jance 2013-10-17 11:56:02 +05:30 committed by Jouni Malinen
parent c41e1d7cac
commit f86d282f43
3 changed files with 20 additions and 7 deletions

View file

@ -117,7 +117,7 @@ static int pno_start(struct wpa_supplicant *wpa_s)
interval = wpa_s->conf->sched_scan_interval ? interval = wpa_s->conf->sched_scan_interval ?
wpa_s->conf->sched_scan_interval : 10; wpa_s->conf->sched_scan_interval : 10;
ret = wpa_drv_sched_scan(wpa_s, &params, interval * 1000); ret = wpa_supplicant_start_sched_scan(wpa_s, &params, interval);
os_free(params.filter_ssids); os_free(params.filter_ssids);
if (ret == 0) if (ret == 0)
wpa_s->pno = 1; wpa_s->pno = 1;
@ -131,7 +131,7 @@ static int pno_stop(struct wpa_supplicant *wpa_s)
if (wpa_s->pno) { if (wpa_s->pno) {
wpa_s->pno = 0; 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) if (wpa_s->wpa_state == WPA_SCANNING)

View file

@ -261,8 +261,7 @@ wpa_supplicant_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx)
} }
static int int wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
struct wpa_driver_scan_params *params, struct wpa_driver_scan_params *params,
int interval) int interval)
{ {
@ -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; int ret;
@ -567,6 +566,16 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
return; 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) && if (!wpa_supplicant_enabled_networks(wpa_s) &&
wpa_s->scan_req == NORMAL_SCAN_REQ) { wpa_s->scan_req == NORMAL_SCAN_REQ) {
wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan"); wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");

View file

@ -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, void scan_only_handler(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res); struct wpa_scan_results *scan_res);
int wpas_scan_scheduled(struct wpa_supplicant *wpa_s); 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 */ #endif /* SCAN_H */