diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index 021d2e884..a4ae8dc8a 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -27,6 +27,8 @@ struct sta_info; struct hostap_sta_driver_data; struct ieee80211_ht_capabilities; struct full_dynamic_vlan; +enum wps_event; +union wps_event_data; struct hostapd_probereq_cb { int (*cb)(void *ctx, const u8 *sa, const u8 *ie, size_t ie_len); @@ -185,6 +187,10 @@ struct hostapd_data { const u8 *uuid_e); void *wps_reg_success_cb_ctx; + void (*wps_event_cb)(void *ctx, enum wps_event event, + union wps_event_data *data); + void *wps_event_cb_ctx; + #ifdef CONFIG_P2P struct p2p_data *p2p; struct p2p_group *p2p_group; diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c index 38ac937a8..b2f6a78c0 100644 --- a/src/ap/wps_hostapd.c +++ b/src/ap/wps_hostapd.c @@ -572,6 +572,8 @@ static void hostapd_wps_event_cb(void *ctx, enum wps_event event, case WPS_EV_ER_AP_SETTINGS: break; } + if (hapd->wps_event_cb) + hapd->wps_event_cb(hapd->wps_event_cb_ctx, event, data); } diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 26a1d11fb..ea5754010 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -17,6 +17,7 @@ #include "utils/common.h" #include "common/ieee802_11_defs.h" +#include "common/wpa_ctrl.h" #include "ap/hostapd.h" #include "ap/ap_config.h" #ifdef NEED_AP_MLME @@ -200,6 +201,26 @@ static void ap_public_action_rx(void *ctx, const u8 *buf, size_t len, int freq) } +static void ap_wps_event_cb(void *ctx, enum wps_event event, + union wps_event_data *data) +{ + struct wpa_supplicant *wpa_s = ctx; + + if (event == WPS_EV_FAIL && wpa_s->parent && wpa_s->parent != wpa_s) { + struct wps_event_fail *fail = &data->fail; + + /* + * src/ap/wps_hostapd.c has already sent this on the main + * interface, so only send on the parent interface here if + * needed. + */ + wpa_msg(wpa_s->parent, MSG_INFO, WPS_EVENT_FAIL + "msg=%d config_error=%d", + fail->msg, fail->config_error); + } +} + + static int ap_vendor_action_rx(void *ctx, const u8 *buf, size_t len, int freq) { #ifdef CONFIG_P2P @@ -366,6 +387,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, ap_probe_req_rx, wpa_s); hapd_iface->bss[i]->wps_reg_success_cb = ap_wps_reg_success_cb; hapd_iface->bss[i]->wps_reg_success_cb_ctx = wpa_s; + hapd_iface->bss[i]->wps_event_cb = ap_wps_event_cb; + hapd_iface->bss[i]->wps_event_cb_ctx = wpa_s; #ifdef CONFIG_P2P hapd_iface->bss[i]->p2p = wpa_s->global->p2p; hapd_iface->bss[i]->p2p_group = wpas_p2p_group_init(