[PATCH] scan: reset normal scan counter when a connection succeeds

Ilan Peer ilan.peer
Wed Apr 23 22:45:36 PDT 2014


From: Luciano Coelho <luciano.coelho at intel.com>

The normal scan counter is used to trigger a few normal scans before a
scheduled scan is issued.  The reason for doing this is that we get
results faster and some drivers support more SSIDs per normal scan
than during sched scan.  After 2 normal scans, we start using
sched_scan.  But the problem is that when a connection succeeds, we do
not reset this counter, so we will keep using sched scans.

To fix this, now we reset the counter when we switch to WPA_COMPLETED
state.

Signed-off-by: Luciano Coelho <luciano.coelho at intel.com>
---
 wpa_supplicant/wpa_supplicant.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5d9cbf7..2cf595f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -673,8 +673,11 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
 		wpa_s->normal_scans = 0;
 	}
 
-	if (state == WPA_COMPLETED)
+	if (state == WPA_COMPLETED) {
 		wpas_connect_work_done(wpa_s);
+		/* Reinitialize normal_scan counter */
+		wpa_s->normal_scans = 0;
+	}
 
 	if (state != WPA_SCANNING)
 		wpa_supplicant_notify_scanning(wpa_s, 0);
-- 
1.7.10.4




More information about the Hostap mailing list