aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2015-01-22 18:50:01 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-22 18:50:01 (GMT)
commitc35e35ed8133bb6d7b96765c5f0b1d41efe09fc5 (patch)
treec8835ac2c8d43ab4dc611ece7832cf5e17f428af
parent180a858f766dae14de6e68e528c6a1407d1419af (diff)
downloadhostap-c35e35ed8133bb6d7b96765c5f0b1d41efe09fc5.zip
hostap-c35e35ed8133bb6d7b96765c5f0b1d41efe09fc5.tar.gz
hostap-c35e35ed8133bb6d7b96765c5f0b1d41efe09fc5.tar.bz2
Add passive_scan configuration parameter
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>
-rw-r--r--wpa_supplicant/config.c1
-rw-r--r--wpa_supplicant/config.h12
-rw-r--r--wpa_supplicant/config_file.c3
-rw-r--r--wpa_supplicant/p2p_supplicant.c1
-rw-r--r--wpa_supplicant/scan.c5
5 files changed, 21 insertions, 1 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 5d7a063..4a56abc 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -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
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index eeb4ba7..6adf1eb 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -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;
};
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 9c9685a..33af428 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -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 */
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 4364a06..65c1b48 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -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);
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 08af9fb..0653cc2 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -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++;