sched scan: Fix passive scanning

Submitted by Eyal Shapira on Nov. 15, 2011, 11:31 p.m.

Details

Message ID 1321399882-18699-1-git-send-email-eyal@wizery.com
State Accepted
Commit 1966e3d1b798984e38b6ea1c2a24f6e5d6205125
Headers show

Commit Message

Eyal Shapira Nov. 15, 2011, 11:31 p.m.
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@ti.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
---
 wpa_supplicant/scan.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

Comments

Jouni Malinen Nov. 18, 2011, 9:07 p.m.
On Wed, Nov 16, 2011 at 01:31:22AM +0200, Eyal Shapira wrote:
> 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.

Thanks, applied.

Patch hide | download patch | download mbox

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);