WPS: Allow the priority for the WPS networks to be configured

This commit adds a configurable parameter (wps_priority) to specify the
priority for the networks derived through WPS connection.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Sunil Dutt 2015-05-25 18:42:24 +05:30 committed by Jouni Malinen
parent 09d57ce40e
commit 94687a0aae
6 changed files with 22 additions and 1 deletions

View file

@ -4225,6 +4225,7 @@ static const struct global_parse_data global_fields[] = {
{ INT(key_mgmt_offload), 0}, { INT(key_mgmt_offload), 0},
{ INT(passive_scan), 0 }, { INT(passive_scan), 0 },
{ INT(reassoc_same_bss_optim), 0 }, { INT(reassoc_same_bss_optim), 0 },
{ INT(wps_priority), 0},
}; };
#undef FUNC #undef FUNC

View file

@ -1164,6 +1164,14 @@ struct wpa_config {
* reassoc_same_bss_optim - Whether to optimize reassoc-to-same-BSS * reassoc_same_bss_optim - Whether to optimize reassoc-to-same-BSS
*/ */
int reassoc_same_bss_optim; int reassoc_same_bss_optim;
/**
* wps_priority - Priority for the networks added through WPS
*
* This priority value will be set to each network profile that is added
* by executing the WPS protocol.
*/
int wps_priority;
}; };

View file

@ -1286,6 +1286,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
if (config->reassoc_same_bss_optim) if (config->reassoc_same_bss_optim)
fprintf(f, "reassoc_same_bss_optim=%d\n", fprintf(f, "reassoc_same_bss_optim=%d\n",
config->reassoc_same_bss_optim); config->reassoc_same_bss_optim);
if (config->wps_priority)
fprintf(f, "wps_priority=%d\n", config->wps_priority);
} }
#endif /* CONFIG_NO_CONFIG_WRITE */ #endif /* CONFIG_NO_CONFIG_WRITE */

View file

@ -662,7 +662,7 @@ static char ** wpa_cli_complete_set(const char *str, int pos)
"tdls_external_control", "osu_dir", "wowlan_triggers", "tdls_external_control", "osu_dir", "wowlan_triggers",
"p2p_search_delay", "mac_addr", "rand_addr_lifetime", "p2p_search_delay", "mac_addr", "rand_addr_lifetime",
"preassoc_mac_addr", "key_mgmt_offload", "passive_scan", "preassoc_mac_addr", "key_mgmt_offload", "passive_scan",
"reassoc_same_bss_optim" "reassoc_same_bss_optim", "wps_priority"
}; };
int i, num_fields = ARRAY_SIZE(fields); int i, num_fields = ARRAY_SIZE(fields);

View file

@ -268,6 +268,11 @@ fast_reauth=1
#wps_nfc_dh_privkey: Hexdump of DH Private Key #wps_nfc_dh_privkey: Hexdump of DH Private Key
#wps_nfc_dev_pw: Hexdump of Device Password #wps_nfc_dev_pw: Hexdump of Device Password
# Priority for the networks added through WPS
# This priority value will be set to each network profile that is added
# by executing the WPS protocol.
#wps_priority=0
# Maximum number of BSS entries to keep in memory # Maximum number of BSS entries to keep in memory
# Default: 200 # Default: 200
# This can be used to limit memory use on the BSS entries (cached scan # This can be used to limit memory use on the BSS entries (cached scan

View file

@ -547,6 +547,7 @@ static int wpa_supplicant_wps_cred(void *ctx,
return -1; return -1;
} }
} }
ssid->priority = wpa_s->conf->wps_priority;
wpas_wps_security_workaround(wpa_s, ssid, cred); wpas_wps_security_workaround(wpa_s, ssid, cred);
@ -560,6 +561,9 @@ static int wpa_supplicant_wps_cred(void *ctx,
} }
#endif /* CONFIG_NO_CONFIG_WRITE */ #endif /* CONFIG_NO_CONFIG_WRITE */
if (ssid->priority)
wpa_config_update_prio_list(wpa_s->conf);
/* /*
* Optimize the post-WPS scan based on the channel used during * Optimize the post-WPS scan based on the channel used during
* the provisioning in case EAP-Failure is not received. * the provisioning in case EAP-Failure is not received.