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>
This commit is contained in:
Jouni Malinen 2015-01-22 20:50:01 +02:00 committed by Jouni Malinen
parent 180a858f76
commit c35e35ed81
5 changed files with 21 additions and 1 deletions

View 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

View 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;
};

View 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 */

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

View 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++;