From e73edcaa6a257b73863b8c05d93207fc96ad4b40 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 4 Apr 2011 12:50:26 +0300 Subject: [PATCH] wpa_s AP mode: Fix regression in P2P AP mode setup Commit c76e5d7f9b7a4ed8c201f280a04e579d52765572 moved the ap_configured_cb() call into a completion callback from AP mode code. However, this callback can be called before hostap_setup_interface() returns. In that case, the ap_configured_cb() ended up getting called before the wpa_supplicant connection information was updated. Fix this by reordering code to set up everything before calling hostapd_setup_interface(). --- wpa_supplicant/ap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index c4f1c00c5..95279d376 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -447,16 +447,16 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, hapd_iface->bss[0]->driver = wpa_s->driver; hapd_iface->bss[0]->drv_priv = wpa_s->drv_priv; + wpa_s->current_ssid = ssid; + os_memcpy(wpa_s->bssid, wpa_s->own_addr, ETH_ALEN); + wpa_s->assoc_freq = ssid->frequency; + if (hostapd_setup_interface(wpa_s->ap_iface)) { wpa_printf(MSG_ERROR, "Failed to initialize AP interface"); wpa_supplicant_ap_deinit(wpa_s); return -1; } - wpa_s->current_ssid = ssid; - os_memcpy(wpa_s->bssid, wpa_s->own_addr, ETH_ALEN); - wpa_s->assoc_freq = ssid->frequency; - return 0; }