diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index e1f4883ac..2fe032d86 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -4225,6 +4225,7 @@ static const struct global_parse_data global_fields[] = { { INT(key_mgmt_offload), 0}, { INT(passive_scan), 0 }, { INT(reassoc_same_bss_optim), 0 }, + { INT(wps_priority), 0}, }; #undef FUNC diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 16681fdb0..545a4bd74 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -1164,6 +1164,14 @@ struct wpa_config { * reassoc_same_bss_optim - Whether to optimize reassoc-to-same-BSS */ 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; }; diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 781f5e5a9..2508ca9c8 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -1286,6 +1286,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) if (config->reassoc_same_bss_optim) fprintf(f, "reassoc_same_bss_optim=%d\n", config->reassoc_same_bss_optim); + + if (config->wps_priority) + fprintf(f, "wps_priority=%d\n", config->wps_priority); } #endif /* CONFIG_NO_CONFIG_WRITE */ diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index bd5846bf8..97e575ca9 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -662,7 +662,7 @@ static char ** wpa_cli_complete_set(const char *str, int pos) "tdls_external_control", "osu_dir", "wowlan_triggers", "p2p_search_delay", "mac_addr", "rand_addr_lifetime", "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); diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index c1bcbd49d..d38096519 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -268,6 +268,11 @@ fast_reauth=1 #wps_nfc_dh_privkey: Hexdump of DH Private Key #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 # Default: 200 # This can be used to limit memory use on the BSS entries (cached scan diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index 61a85876b..a97c2a8d4 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -547,6 +547,7 @@ static int wpa_supplicant_wps_cred(void *ctx, return -1; } } + ssid->priority = wpa_s->conf->wps_priority; 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 */ + if (ssid->priority) + wpa_config_update_prio_list(wpa_s->conf); + /* * Optimize the post-WPS scan based on the channel used during * the provisioning in case EAP-Failure is not received.