]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add passive_scan configuration parameter
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 22 Jan 2015 18:50:01 +0000 (20:50 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 22 Jan 2015 18:50:01 +0000 (20:50 +0200)
This new wpa_supplicant configuration parameter can be used to force
passive scanning to be used for most scanning cases at the cost of
increased latency and less reliably scans. This may be of use for both
testing purposes and somewhat increased privacy due to no Probe Request
frames with fixed MAC address being sent out.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/scan.c

index 5d7a063cd3031676a3bdb8544544e0815ab7f839..4a56abc336b8ffa22a92dd352e5ba0c83a02a43f 100644 (file)
@@ -4129,6 +4129,7 @@ static const struct global_parse_data global_fields[] = {
        { INT(rand_addr_lifetime), 0 },
        { INT(preassoc_mac_addr), 0 },
        { INT(key_mgmt_offload), 0},
+       { INT(passive_scan), 0 },
 };
 
 #undef FUNC
index eeb4ba7f83c79b4da3339ea3cd17a4ff4733420c..6adf1eb38f3ce4f621ac10c4c6ec2e0132ce686a 100644 (file)
@@ -1137,6 +1137,18 @@ struct wpa_config {
         * By default: 300 seconds.
         */
        int mesh_max_inactivity;
+
+       /**
+        * passive_scan - Whether to force passive scan for network connection
+        *
+        * This parameter can be used to force only passive scanning to be used
+        * for network connection cases. It should be noted that this will slow
+        * down scan operations and reduce likelihood of finding the AP. In
+        * addition, some use cases will override this due to functional
+        * requirements, e.g., for finding an AP that uses hidden SSID
+        * (scan_ssid=1) or P2P device discovery.
+        */
+       int passive_scan;
 };
 
 
index 9c9685a7dcc4cf894b55d998936288e2bc7f0eb1..33af428d2baf5333b5853390f454e787876f848e 100644 (file)
@@ -1227,6 +1227,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
        if (config->mesh_max_inactivity != DEFAULT_MESH_MAX_INACTIVITY)
                fprintf(f, "mesh_max_inactivity=%d\n",
                        config->mesh_max_inactivity);
+
+       if (config->passive_scan)
+               fprintf(f, "cert_in_cb=%d\n", config->passive_scan);
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */
index 4364a0649547c1cde157df427dc53c1de680904d..65c1b486f9fe8dbd092954a6b2ff035b223ea1be 100644 (file)
@@ -1546,6 +1546,7 @@ static void wpas_p2p_clone_config(struct wpa_supplicant *dst,
        d->dtim_period = s->dtim_period;
        d->disassoc_low_ack = s->disassoc_low_ack;
        d->disable_scan_offload = s->disable_scan_offload;
+       d->passive_scan = s->passive_scan;
 
        if (s->wps_nfc_dh_privkey && s->wps_nfc_dh_pubkey) {
                d->wps_nfc_dh_privkey = wpabuf_dup(s->wps_nfc_dh_privkey);
index 08af9fbac678fcf0cd6bf17494d7aa164ed6b53a..0653cc28a7b6e0c06810a9c95e4419573f9356a5 100644 (file)
@@ -724,7 +724,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 
 #ifdef CONFIG_P2P
        if ((wpa_s->p2p_in_provisioning || wpa_s->show_group_started) &&
-           wpa_s->go_params) {
+           wpa_s->go_params && !wpa_s->conf->passive_scan) {
                wpa_printf(MSG_DEBUG, "P2P: Use specific SSID for scan during P2P group formation (p2p_in_provisioning=%d show_group_started=%d)",
                           wpa_s->p2p_in_provisioning,
                           wpa_s->show_group_started);
@@ -878,6 +878,9 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
        } 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 if (wpa_s->conf->passive_scan) {
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "Use passive scan based on configuration");
        } else {
                wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
                params.num_ssids++;