]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Fix struct hostapd_data initialization
authorJouni Malinen <j@w1.fi>
Sat, 4 Feb 2017 20:17:54 +0000 (22:17 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Feb 2017 20:17:54 +0000 (22:17 +0200)
The local custom version of allocating and initializing struct
hostapd_data within wpa_supplicant_mesh_init() is problematic. This has
already missed couple of initialization steps that are required. Instead
of trying to remember to keep this up to date, use
hostapd_alloc_bss_data() so that there is only one place for this
initialization.

This is fixing a recent issue where FILS HLP started using
hapd->dhcp_server and expected that to be initialized to -1. For the
mesh case, that did not happen and when removing the interface, the FILS
HLP implementation ended up unregistering eloop socket for
hapd->dhcp_server (= 0). This could result in missing socket callbacks
for an arbitrary socket.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/hostapd.c
wpa_supplicant/mesh.c

index 47fa144c4e9bddbbd098b2b4f24b478ee36ca29c..cf8a8cb37316fdee05556aa55244c67755af23e7 100644 (file)
@@ -2004,7 +2004,8 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
        hapd->iconf = conf;
        hapd->conf = bss;
        hapd->iface = hapd_iface;
-       hapd->driver = hapd->iconf->driver;
+       if (conf)
+               hapd->driver = conf->driver;
        hapd->ctrl_sock = -1;
        dl_list_init(&hapd->ctrl_dst);
        dl_list_init(&hapd->nr_db);
index 602ed2eb2840849bfe4dd9a09f8bca8eb4878cdf..2ca81a3821707a6c15b824eca04854ce6919a332 100644 (file)
@@ -177,10 +177,9 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
        if (!ifmsh->bss)
                goto out_free;
 
-       ifmsh->bss[0] = bss = os_zalloc(sizeof(struct hostapd_data));
+       ifmsh->bss[0] = bss = hostapd_alloc_bss_data(NULL, NULL, NULL);
        if (!bss)
                goto out_free;
-       dl_list_init(&bss->nr_db);
 
        os_memcpy(bss->own_addr, wpa_s->own_addr, ETH_ALEN);
        bss->driver = wpa_s->driver;