]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Update configuration file after re-enabling networks
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 21 Dec 2012 18:11:26 +0000 (20:11 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 21 Dec 2012 18:11:26 +0000 (20:11 +0200)
Network blocks are disabled during a WPS provisioning step and 10
seconds after this to allow the newly provisioned network to be
selected. The disabled=1 flag gets written to the configuration file
when the credential is added since it happens during this process.
Update the file again after the networks have been re-enabled to avoid
leaving the configuration file into state that is not consistent with
the running configuration.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/wps_supplicant.c

index 0bf297978cdc71640238d244ed61e7ea44f61cbd..8ab5f64bd00ed5c5af7f98f485ad5240d2848559 100644 (file)
@@ -511,6 +511,7 @@ static void wpas_wps_reenable_networks_cb(void *eloop_ctx, void *timeout_ctx);
 static void wpas_wps_reenable_networks(struct wpa_supplicant *wpa_s)
 {
        struct wpa_ssid *ssid;
+       int changed = 0;
 
        eloop_cancel_timeout(wpas_wps_reenable_networks_cb, wpa_s, NULL);
 
@@ -519,8 +520,19 @@ static void wpas_wps_reenable_networks(struct wpa_supplicant *wpa_s)
                        ssid->disabled_for_connect = 0;
                        ssid->disabled = 0;
                        wpas_notify_network_enabled_changed(wpa_s, ssid);
+                       changed++;
                }
        }
+
+       if (changed) {
+#ifndef CONFIG_NO_CONFIG_WRITE
+               if (wpa_s->conf->update_config &&
+                   wpa_config_write(wpa_s->confname, wpa_s->conf)) {
+                       wpa_printf(MSG_DEBUG, "WPS: Failed to update "
+                                  "configuration");
+               }
+#endif /* CONFIG_NO_CONFIG_WRITE */
+       }
 }