diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index c7faee6ca..4e5eb0199 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -784,6 +784,9 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err) return -1; } + if (hapd->setup_complete_cb) + hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); + wpa_printf(MSG_DEBUG, "%s: Setup of interface done.", iface->bss[0]->conf->iface); diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index d649d6062..bb600e158 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -145,6 +145,9 @@ struct hostapd_data { int authorized); void *sta_authorized_cb_ctx; + void (*setup_complete_cb)(void *ctx); + void *setup_complete_cb_ctx; + #ifdef CONFIG_P2P struct p2p_data *p2p; struct p2p_group *p2p_group; diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index fb7a10fdd..c4f1c00c5 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -293,6 +293,18 @@ static void ap_wps_reg_success_cb(void *ctx, const u8 *mac_addr, } +static void wpas_ap_configured_cb(void *ctx) +{ + struct wpa_supplicant *wpa_s = ctx; + + wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); + + if (wpa_s->ap_configured_cb) + wpa_s->ap_configured_cb(wpa_s->ap_configured_cb_ctx, + wpa_s->ap_configured_cb_data); +} + + int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { @@ -427,6 +439,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, wpa_s, ssid->p2p_persistent_group, ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION); #endif /* CONFIG_P2P */ + hapd_iface->bss[i]->setup_complete_cb = wpas_ap_configured_cb; + hapd_iface->bss[i]->setup_complete_cb_ctx = wpa_s; } os_memcpy(hapd_iface->bss[0]->own_addr, wpa_s->own_addr, ETH_ALEN); @@ -442,11 +456,6 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, wpa_s->current_ssid = ssid; os_memcpy(wpa_s->bssid, wpa_s->own_addr, ETH_ALEN); wpa_s->assoc_freq = ssid->frequency; - wpa_supplicant_set_state(wpa_s, WPA_COMPLETED); - - if (wpa_s->ap_configured_cb) - wpa_s->ap_configured_cb(wpa_s->ap_configured_cb_ctx, - wpa_s->ap_configured_cb_data); return 0; }