WPS: Fix stopping of active WPS operation on dual concurrent AP

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>
This commit is contained in:
Subrat Dash 2011-11-30 16:48:14 +02:00 committed by Jouni Malinen
parent d6d731b848
commit 910b482d9b
3 changed files with 31 additions and 0 deletions

View 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, static void hostapd_wps_reg_success_cb(void *ctx, const u8 *mac_addr,
const u8 *uuid_e) const u8 *uuid_e)
{ {
struct hostapd_data *hapd = ctx; struct hostapd_data *hapd = ctx;
char uuid[40]; char uuid[40];
struct wps_stop_reg_data data;
if (uuid_bin2str(uuid_e, uuid, sizeof(uuid))) if (uuid_bin2str(uuid_e, uuid, sizeof(uuid)))
return; return;
wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_REG_SUCCESS MACSTR " %s", 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) if (hapd->wps_reg_success_cb)
hapd->wps_reg_success_cb(hapd->wps_reg_success_cb_ctx, hapd->wps_reg_success_cb(hapd->wps_reg_success_cb_ctx,
mac_addr, uuid_e); mac_addr, uuid_e);
data.current_hapd = hapd;
data.uuid_e = uuid_e;
hostapd_wps_for_each(hapd, wps_stop_registrar, &data);
} }

View 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_unlock_pin(struct wps_registrar *reg, const u8 *uuid);
int wps_registrar_button_pushed(struct wps_registrar *reg, int wps_registrar_button_pushed(struct wps_registrar *reg,
const u8 *p2p_dev_addr); 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, void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
const struct wpabuf *wps_data, const struct wpabuf *wps_data,
int p2p_wildcard); int p2p_wildcard);

View 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) int wps_registrar_wps_cancel(struct wps_registrar *reg)
{ {
if (reg->pbc) { if (reg->pbc) {