]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Fix stopping of active WPS operation on dual concurrent AP
authorSubrat Dash <sdash@qca.qualcomm.com>
Wed, 30 Nov 2011 14:48:14 +0000 (16:48 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 30 Nov 2011 14:48:14 +0000 (16:48 +0200)
When hostapd controls multiple radios, WPS operations are started on
all interfaces. However, when the provisioning run had been completed
successfully, actiove WPS mode was stopped only a single interface. Fix
this to iterate through all interfaces so that this is handled
consistently with the starting of WPS operation.

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

src/ap/wps_hostapd.c
src/wps/wps.h
src/wps/wps_registrar.c

index 28e037dc167b7566de7f398bbfef608418e80110..87bbd3763c52f1f6026b03b81b9a6e250fb835a6 100644 (file)
@@ -186,11 +186,26 @@ static void hostapd_wps_pin_needed_cb(void *ctx, const u8 *uuid_e,
 }
 
 
+struct wps_stop_reg_data {
+       struct hostapd_data *current_hapd;
+       const u8 *uuid_e;
+};
+
+static int wps_stop_registrar(struct hostapd_data *hapd, void *ctx)
+{
+       struct wps_stop_reg_data *data = ctx;
+       if (hapd != data->current_hapd && hapd->wps != NULL)
+               wps_registrar_complete(hapd->wps->registrar, data->uuid_e);
+       return 0;
+}
+
+
 static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr,
                                       const u8 *uuid_e)
 {
        struct hostapd_data *hapd = ctx;
        char uuid[40];
+       struct wps_stop_reg_data data;
        if (uuid_bin2str(uuid_e, uuid, sizeof(uuid)))
                return;
        wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s",
@@ -198,6 +213,9 @@ static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr,
        if (hapd->wps_reg_success_cb)
                hapd->wps_reg_success_cb(hapd->wps_reg_success_cb_ctx,
                                         mac_addr, uuid_e);
+       data.current_hapd = hapd;
+       data.uuid_e = uuid_e;
+       hostapd_wps_for_each(hapd, wps_stop_registrar, &data);
 }
 
 
index cdafc2709ead83067f9445fddca32b23ef3f6694..4986881b009a7acd53f668216b3e8e880e5d4d2c 100644 (file)
@@ -784,6 +784,7 @@ int wps_registrar_wps_cancel(struct wps_registrar *reg);
 int wps_registrar_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
 int wps_registrar_button_pushed(struct wps_registrar *reg,
                                const u8 *p2p_dev_addr);
+void wps_registrar_complete(struct wps_registrar *registrar, const u8 *uuid_e);
 void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
                                const struct wpabuf *wps_data,
                                int p2p_wildcard);
index 66ed41086a09c5f86d2692bbca729501ecdcfe7a..e59edb87aa9da32503d4959b39f32509e499c385 100644 (file)
@@ -941,6 +941,18 @@ static void wps_registrar_pin_completed(struct wps_registrar *reg)
 }
 
 
+void wps_registrar_complete(struct wps_registrar *registrar, const u8 *uuid_e)
+{
+       if (registrar->pbc) {
+               wps_registrar_remove_pbc_session(registrar,
+                                                uuid_e);
+               wps_registrar_pbc_completed(registrar);
+       } else {
+               wps_registrar_pin_completed(registrar);
+       }
+}
+
+
 int wps_registrar_wps_cancel(struct wps_registrar *reg)
 {
        if (reg->pbc) {