]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Allow passive scan to be requested with SCAN passive=1
authorJouni Malinen <j@w1.fi>
Thu, 26 Dec 2013 14:52:55 +0000 (16:52 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Dec 2013 16:27:48 +0000 (18:27 +0200)
This allows external programs to request wpa_supplicant to execute
a passive scan (i.e., do not send any Probe Request frames).

Signed-hostap: Jouni Malinen <j@w1.fi>

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

index e424c6f067ae9bd1106de300175b80a19b0f1376..8518d4b99ee45af72085dfb18e839ab57223a3b0 100644 (file)
@@ -5263,6 +5263,8 @@ static void wpas_ctrl_scan(struct wpa_supplicant *wpa_s, char *params,
                return;
        }
 
+       wpa_s->manual_scan_passive = 0;
+
        if (params) {
                if (os_strncasecmp(params, "TYPE=ONLY", 9) == 0)
                        wpa_s->scan_res_handler = scan_only_handler;
@@ -5272,6 +5274,10 @@ static void wpas_ctrl_scan(struct wpa_supplicant *wpa_s, char *params,
                        *reply_len = -1;
                        return;
                }
+
+               pos = os_strstr(params, "passive=");
+               if (pos)
+                       wpa_s->manual_scan_passive = !!atoi(pos + 8);
        } else {
                os_free(wpa_s->manual_scan_freqs);
                wpa_s->manual_scan_freqs = NULL;
index c22ffbf2e614a708404f3edf676c11286ff562db..d9634522643393f19aa1cce7be82d59b8e485c96 100644 (file)
@@ -698,6 +698,9 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
                wpa_dbg(wpa_s, MSG_DEBUG, "Include wildcard SSID in "
                        "the scan request");
                params.num_ssids++;
+       } else if (wpa_s->last_scan_req == MANUAL_SCAN_REQ &&
+                  wpa_s->manual_scan_passive && params.num_ssids == 0) {
+               wpa_dbg(wpa_s, MSG_DEBUG, "Use passive scan based on manual request");
        } else {
                wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
                params.num_ssids++;
index 5194e34240ab5429d0030a74fab0b5cd266c6e5d..ebe30e4efc4b07d07691c62fffa45ac3b6deae51 100644 (file)
@@ -482,6 +482,7 @@ struct wpa_supplicant {
        int scan_runs; /* number of scan runs since WPS was started */
        int *next_scan_freqs;
        int *manual_scan_freqs;
+       unsigned int manual_scan_passive:1;
        int scan_interval; /* time in sec between scans to find suitable AP */
        int normal_scans; /* normal scans run before sched_scan */
        int scan_for_connection; /* whether the scan request was triggered for