Continue scanning if sched_scan stops unexpectedly

When scheduled scan stops without the interface request (for example,
driver stopped it unexpectedly), start a regular scan to continue
scanning for networks and avoid being left with no scan at all.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
This commit is contained in:
Avraham Stern 2016-09-05 17:32:59 +03:00 committed by Jouni Malinen
parent 1ac388633a
commit 14f34a7303
3 changed files with 21 additions and 0 deletions

View file

@ -4065,6 +4065,20 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
break;
/*
* If the driver stopped scanning without being requested to,
* request a new scan to continue scanning for networks.
*/
if (!wpa_s->sched_scan_stop_req &&
wpa_s->wpa_state == WPA_SCANNING) {
wpa_dbg(wpa_s, MSG_DEBUG,
"Restart scanning after unexpected sched_scan stop event");
wpa_supplicant_req_scan(wpa_s, 1, 0);
break;
}
wpa_s->sched_scan_stop_req = 0;
/*
* Start a new sched scan to continue searching for more SSIDs
* either if timed out or PNO schedule scan is pending.

View file

@ -1256,6 +1256,8 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
if (max_sched_scan_ssids < 1 || wpa_s->conf->disable_scan_offload)
return -1;
wpa_s->sched_scan_stop_req = 0;
if (wpa_s->sched_scanning) {
wpa_dbg(wpa_s, MSG_DEBUG, "Already sched scanning");
return 0;
@ -1554,6 +1556,9 @@ void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s)
if (!wpa_s->sched_scanning)
return;
if (wpa_s->sched_scanning)
wpa_s->sched_scan_stop_req = 1;
wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling sched scan");
eloop_cancel_timeout(wpa_supplicant_sched_scan_timeout, wpa_s, NULL);
wpa_supplicant_stop_sched_scan(wpa_s);
@ -2530,6 +2535,7 @@ int wpas_stop_pno(struct wpa_supplicant *wpa_s)
return 0;
ret = wpa_supplicant_stop_sched_scan(wpa_s);
wpa_s->sched_scan_stop_req = 1;
wpa_s->pno = 0;
wpa_s->pno_sched_pending = 0;

View file

@ -574,6 +574,7 @@ struct wpa_supplicant {
struct wpa_radio_work *scan_work;
int scanning;
int sched_scanning;
unsigned int sched_scan_stop_req:1;
int new_connection;
int eapol_received; /* number of EAPOL packets received after the