From: Jouni Malinen Date: Fri, 21 Dec 2012 18:11:26 +0000 (+0200) Subject: WPS: Update configuration file after re-enabling networks X-Git-Tag: hostap_2_0~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=318e772ad1ee056b3ed8f5e3fdd4037e01fe3f5e;p=thirdparty%2Fhostap.git 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 --- diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index 0bf297978..8ab5f64bd 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/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) { 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 */ + } }