]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/config_file.c
wpa_supplicant: Add option -I for additional config file
[thirdparty/hostap.git] / wpa_supplicant / config_file.c
index f29f7a6b92c6ddcc50ac9945777163fe8e265278..8604ae8a41c09baba4b9cdc63dcd0745d63988b2 100644 (file)
@@ -345,7 +345,7 @@ static int wpa_config_process_blob(struct wpa_config *config, FILE *f,
 #endif /* CONFIG_NO_CONFIG_BLOBS */
 
 
-struct wpa_config * wpa_config_read(const char *name)
+struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp)
 {
        FILE *f;
        char buf[512], *pos;
@@ -356,12 +356,19 @@ struct wpa_config * wpa_config_read(const char *name)
        int id = 0;
        int cred_id = 0;
 
-       config = wpa_config_alloc_empty(NULL, NULL);
+       if (name == NULL)
+               return NULL;
+       if (cfgp)
+               config = cfgp;
+       else
+               config = wpa_config_alloc_empty(NULL, NULL);
        if (config == NULL) {
                wpa_printf(MSG_ERROR, "Failed to allocate config file "
                           "structure");
                return NULL;
        }
+       head = config->ssid;
+       cred_head = config->cred;
 
        wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name);
        f = fopen(name, "r");
@@ -690,6 +697,8 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
 #ifdef CONFIG_P2P
        write_p2p_client_list(f, ssid);
 #endif /* CONFIG_P2P */
+       INT(dtim_period);
+       INT(beacon_int);
 
 #undef STR
 #undef INT
@@ -915,6 +924,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
        if (config->p2p_no_group_iface)
                fprintf(f, "p2p_no_group_iface=%u\n",
                        config->p2p_no_group_iface);
+       if (config->p2p_ignore_shared_freq)
+               fprintf(f, "p2p_ignore_shared_freq=%u\n",
+                       config->p2p_ignore_shared_freq);
 #endif /* CONFIG_P2P */
        if (config->country[0] && config->country[1]) {
                fprintf(f, "country=%c%c\n",
@@ -974,6 +986,10 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
                fprintf(f, "okc=%d\n", config->okc);
        if (config->pmf)
                fprintf(f, "pmf=%d\n", config->pmf);
+       if (config->dtim_period)
+               fprintf(f, "dtim_period=%d\n", config->dtim_period);
+       if (config->beacon_int)
+               fprintf(f, "beacon_int=%d\n", config->beacon_int);
 
        if (config->sae_groups) {
                int i;
@@ -984,6 +1000,21 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
                }
                fprintf(f, "\n");
        }
+
+       if (config->ap_vendor_elements) {
+               int i, len = wpabuf_len(config->ap_vendor_elements);
+               const u8 *p = wpabuf_head_u8(config->ap_vendor_elements);
+               if (len > 0) {
+                       fprintf(f, "ap_vendor_elements=");
+                       for (i = 0; i < len; i++)
+                               fprintf(f, "%02x", *p++);
+                       fprintf(f, "\n");
+               }
+       }
+
+       if (config->ignore_old_scan_res)
+               fprintf(f, "ignore_old_scan_res=%d\n",
+                       config->ignore_old_scan_res);
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */