]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Handle legacy scan interruption of sched_scan/PNO
authorJithu Jance <jithu@broadcom.com>
Thu, 17 Oct 2013 06:26:02 +0000 (11:56 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 18 Nov 2013 12:35:48 +0000 (14:35 +0200)
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>

wpa_supplicant/ctrl_iface.c
wpa_supplicant/scan.c
wpa_supplicant/scan.h

index 280441ed78a60eead441fb39f700f9a0621be01b..6472f4f5cd634d93522c3ceae03fb298ba752e07 100644 (file)
@@ -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, &params, interval * 1000);
+       ret = wpa_supplicant_start_sched_scan(wpa_s, &params, 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)
index 6d679d2c47f627cbbd7ddd1612cd560edaf9fce2..7baacaa6f555b1abbb1389ef838c4a97678b4975 100644 (file)
@@ -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");
index 66581a9db1deb2d1791fc92200c35f05b0d044c7..b6fe070e287a77d4a32c8fc52277fa294f56af22 100644 (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,
                       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 */