Browse Source

WPS: Update configuration file after re-enabling networks

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>
Jouni Malinen 12 years ago
parent
commit
318e772ad1
1 changed files with 12 additions and 0 deletions
  1. 12 0
      wpa_supplicant/wps_supplicant.c

+ 12 - 0
wpa_supplicant/wps_supplicant.c

@@ -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)
 static void wpas_wps_reenable_networks(struct wpa_supplicant *wpa_s)
 {
 {
 	struct wpa_ssid *ssid;
 	struct wpa_ssid *ssid;
+	int changed = 0;
 
 
 	eloop_cancel_timeout(wpas_wps_reenable_networks_cb, wpa_s, NULL);
 	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_for_connect = 0;
 			ssid->disabled = 0;
 			ssid->disabled = 0;
 			wpas_notify_network_enabled_changed(wpa_s, ssid);
 			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 */
+	}
 }
 }