wpa_s AP mode: Fix regression in P2P AP mode setup
authorJouni Malinen <jouni.malinen@atheros.com>
Mon, 4 Apr 2011 09:50:26 +0000 (12:50 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 4 Apr 2011 09:50:26 +0000 (12:50 +0300)
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

index c4f1c00..95279d3 100644 (file)
@@ -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;
 }