[PATCH] sched scan: Fix passive scanning

Eyal Shapira eyal
Tue Nov 15 15:31:22 PST 2011


Scan wasn't initiated in case the config contained only networks without scan_ssid.
In such a case we want scan to be initiated without any SSIDs to actively scan
but include all the SSIDs in the filter list.
Also added some debug logs to easily see which SSIDs were included in which list.

Cc: Luciano Coelho <coelho at ti.com>
Signed-off-by: Eyal Shapira <eyal at wizery.com>
---
 wpa_supplicant/scan.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index e30d8eb..d6d45ee 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -710,8 +710,10 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 	else
 		max_sched_scan_ssids = wpa_s->max_sched_scan_ssids;
 
-	if (wpa_s->sched_scanning)
+	if (wpa_s->sched_scanning) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Already sched scanning");
 		return 0;
+	}
 
 	os_memset(&params, 0, sizeof(params));
 
@@ -754,6 +756,8 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 		}
 
 		if (params.filter_ssids && ssid->ssid && ssid->ssid_len) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "add to filter ssid: %s",
+				wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
 			os_memcpy(params.filter_ssids[params.num_filter_ssids].ssid,
 				  ssid->ssid, ssid->ssid_len);
 			params.filter_ssids[params.num_filter_ssids].ssid_len =
@@ -762,6 +766,8 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 		}
 
 		if (ssid->scan_ssid) {
+			wpa_dbg(wpa_s, MSG_DEBUG, "add to active scan ssid: %s",
+				wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
 			params.ssids[params.num_ssids].ssid =
 				ssid->ssid;
 			params.ssids[params.num_ssids].ssid_len =
@@ -779,11 +785,6 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
 		ssid = ssid->next;
 	}
 
-	if (!params.num_ssids) {
-		os_free(params.filter_ssids);
-		return 0;
-	}
-
 	if (wpa_s->wps)
 		wps_ie = wpa_supplicant_extra_ies(wpa_s, &params);
 
-- 
1.7.4.1




More information about the Hostap mailing list