diff mbox

Don't start second scan when changing scan interval

Message ID 1382100572-14485-1-git-send-email-pontus.fuchs@gmail.com
State Accepted
Commit c6f5dec9c10ecddb419227acbb7860c44991029d
Headers show

Commit Message

Pontus Fuchs Oct. 18, 2013, 12:49 p.m. UTC
If a scan is currently running and the scan interval is changed, a
second scan will be started before the current has finished. This will
in turn, if no networks are configured, cause wpa_s->state to be
forced to WPA_INACTIVE before the first scan has finished.

Signed-hostap: Pontus Fuchs <pontus.fuchs@gmail.com>
---
 wpa_supplicant/scan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Oct. 22, 2013, 1:27 p.m. UTC | #1
On Fri, Oct 18, 2013 at 02:49:32PM +0200, Pontus Fuchs wrote:
> If a scan is currently running and the scan interval is changed, a
> second scan will be started before the current has finished. This will
> in turn, if no networks are configured, cause wpa_s->state to be
> forced to WPA_INACTIVE before the first scan has finished.

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index be826db..bb7565d 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -878,8 +878,10 @@  void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec)
 		new_int.usec = remaining.usec;
 	}
 
-	eloop_register_timeout(new_int.sec, new_int.usec, wpa_supplicant_scan,
-			       wpa_s, NULL);
+	if (cancelled) {
+		eloop_register_timeout(new_int.sec, new_int.usec,
+				       wpa_supplicant_scan, wpa_s, NULL);
+	}
 	wpa_s->scan_interval = sec;
 }