Apply WPS configuration changes to all interfaces that use WPS
authorJouni Malinen <jouni.malinen@atheros.com>
Fri, 8 Oct 2010 14:32:10 +0000 (17:32 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 8 Oct 2010 14:32:10 +0000 (17:32 +0300)
When a single hostapd process is controlling multiple interfaces,
apply the received or auto-generated configuration changes to all
interfaces that have enabled WPS.

src/ap/wps_hostapd.c

index 115f2d4..d131a84 100644 (file)
@@ -239,9 +239,9 @@ static void wps_reload_config(void *eloop_data, void *user_ctx)
 }
 
 
-static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
+static int hapd_wps_cred_cb(struct hostapd_data *hapd, void *ctx)
 {
-       struct hostapd_data *hapd = ctx;
+       const struct wps_credential *cred = ctx;
        FILE *oconf, *nconf;
        size_t len, i;
        char *tmp_fname;
@@ -249,6 +249,9 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
        int multi_bss;
        int wpa;
 
+       if (hapd->wps == NULL)
+               return 0;
+
        wpa_hexdump_key(MSG_DEBUG, "WPS: Received Credential attribute",
                        cred->cred_attr, cred->cred_attr_len);
 
@@ -453,14 +456,19 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
        eloop_register_timeout(0, 100000, wps_reload_config, hapd->iface,
                               NULL);
 
-       /* TODO: dualband AP may need to update multiple configuration files */
-
        wpa_printf(MSG_DEBUG, "WPS: AP configuration updated");
 
        return 0;
 }
 
 
+static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred)
+{
+       struct hostapd_data *hapd = ctx;
+       return hostapd_wps_for_each(hapd, hapd_wps_cred_cb, (void *) cred);
+}
+
+
 static void hostapd_wps_reenable_ap_pin(void *eloop_data, void *user_ctx)
 {
        struct hostapd_data *hapd = eloop_data;