]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Allow hostapd process to control independent WPS interfaces
authorJouni Malinen <j@w1.fi>
Sun, 31 Mar 2013 08:48:52 +0000 (11:48 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 31 Mar 2013 09:34:35 +0000 (12:34 +0300)
The new wps_independent=1 configuration parameter can be used to remove
interfaces from the shared hostapd process WPS control (i.e., to apply
WPS operations only to a subset of interfaces instead of all).

Signed-hostap: Jouni Malinen <j@w1.fi>

hostapd/config_file.c
hostapd/hostapd.conf
src/ap/ap_config.h
src/ap/wps_hostapd.c

index e29ae2fbb5b38188ce21b63206add5bdc21262b3..12d627a8aaa66831ed30a728661ad8f209015dbc 100644 (file)
@@ -2509,6 +2509,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                                           "wps_state", line);
                                errors++;
                        }
+               } else if (os_strcmp(buf, "wps_independent") == 0) {
+                       bss->wps_independent = atoi(pos);
                } else if (os_strcmp(buf, "ap_setup_locked") == 0) {
                        bss->ap_setup_locked = atoi(pos);
                } else if (os_strcmp(buf, "uuid") == 0) {
index eca39960446df955be57c11a2590fd2926e0c016..17bb7ed785620b3d6fd060c611e8b01b0f1f96ae 100644 (file)
@@ -1124,6 +1124,14 @@ own_ip_addr=127.0.0.1
 # 2 = WPS enabled, configured
 #wps_state=2
 
+# Whether to manage this interface independently from other WPS interfaces
+# By default, a single hostapd process applies WPS operations to all configured
+# interfaces. This parameter can be used to disable that behavior for a subset
+# of interfaces. If this is set to non-zero for an interface, WPS commands
+# issued on that interface do not apply to other interfaces and WPS operations
+# performed on other interfaces do not affect this interface.
+#wps_independent=0
+
 # AP can be configured into a locked state where new WPS Registrar are not
 # accepted, but previously authorized Registrars (including the internal one)
 # can continue to add new Enrollees.
index 6606f72d7c220cfd559b51d7827b79a34eaf3a7d..d9ef984df62ff17d9ed5b399a8c6cf39c271b928 100644 (file)
@@ -340,6 +340,7 @@ struct hostapd_bss_config {
 
        int wps_state;
 #ifdef CONFIG_WPS
+       int wps_independent;
        int ap_setup_locked;
        u8 uuid[16];
        char *wps_pin_requests;
index b6d9c20bcc7d0c2d5c6d6ae551b1160acff7e2b8..69b34fef365683fb4855c353ab6bfbe0e95f1f66 100644 (file)
@@ -45,6 +45,7 @@ static void hostapd_wps_ap_pin_timeout(void *eloop_data, void *user_ctx);
 struct wps_for_each_data {
        int (*func)(struct hostapd_data *h, void *ctx);
        void *ctx;
+       struct hostapd_data *calling_hapd;
 };
 
 
@@ -57,7 +58,14 @@ static int wps_for_each(struct hostapd_iface *iface, void *ctx)
                return 0;
        for (j = 0; j < iface->num_bss; j++) {
                struct hostapd_data *hapd = iface->bss[j];
-               int ret = data->func(hapd, data->ctx);
+               int ret;
+
+               if (hapd != data->calling_hapd &&
+                   (hapd->conf->wps_independent ||
+                    data->calling_hapd->conf->wps_independent))
+                       continue;
+
+               ret = data->func(hapd, data->ctx);
                if (ret)
                        return ret;
        }
@@ -74,6 +82,7 @@ static int hostapd_wps_for_each(struct hostapd_data *hapd,
        struct wps_for_each_data data;
        data.func = func;
        data.ctx = ctx;
+       data.calling_hapd = hapd;
        if (iface->interfaces == NULL ||
            iface->interfaces->for_each_interface == NULL)
                return wps_for_each(iface, &data);
@@ -814,7 +823,8 @@ static int get_uuid_cb(struct hostapd_iface *iface, void *ctx)
                return 0;
        for (j = 0; j < iface->num_bss; j++) {
                struct hostapd_data *hapd = iface->bss[j];
-               if (hapd->wps && !is_nil_uuid(hapd->wps->uuid)) {
+               if (hapd->wps && !hapd->conf->wps_independent &&
+                   !is_nil_uuid(hapd->wps->uuid)) {
                        *uuid = hapd->wps->uuid;
                        return 1;
                }
@@ -907,7 +917,7 @@ int hostapd_init_wps(struct hostapd_data *hapd,
        if (is_nil_uuid(hapd->conf->uuid)) {
                const u8 *uuid;
                uuid = get_own_uuid(hapd->iface);
-               if (uuid) {
+               if (uuid && !conf->wps_independent) {
                        os_memcpy(wps->uuid, uuid, UUID_LEN);
                        wpa_hexdump(MSG_DEBUG, "WPS: Clone UUID from another "
                                    "interface", wps->uuid, UUID_LEN);