WPS: Allow the priority for the WPS networks to be configured
authorSunil Dutt <usdutt@qti.qualcomm.com>
Mon, 25 May 2015 13:12:24 +0000 (18:42 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 4 Jun 2015 10:55:16 +0000 (13:55 +0300)
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>
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/wpa_cli.c
wpa_supplicant/wpa_supplicant.conf
wpa_supplicant/wps_supplicant.c

index e1f4883..2fe032d 100644 (file)
@@ -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
index 16681fd..545a4bd 100644 (file)
@@ -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;
 };
 
 
index 781f5e5..2508ca9 100644 (file)
@@ -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 */
index bd5846b..97e575c 100644 (file)
@@ -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);
 
index c1bcbd4..d380965 100644 (file)
@@ -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
index 61a8587..a97c2a8 100644 (file)
@@ -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.