hostapd: fix segfault in wpa_supplicant ubus
authorDaniel Golle <daniel@makrotopia.org>
Wed, 18 Mar 2020 17:58:43 +0000 (18:58 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 18 Mar 2020 18:05:22 +0000 (19:05 +0100)
When introducing ubus reload support, ubus initialization was moved
to the service level instead of being carried out when adding a BSS
configuration. While this works when using wpa_supplicant in that way,
it breaks the ability to run wpa_supplicant on the command line, eg.
for debugging purposes.
Fix that by re-introducing ubus context intialization when adding
configuration.

Reported-by: @PolynomialDivision https://github.com/openwrt/openwrt/pull/2417
Fixes: 60fb4c92b6 ("hostapd: add ubus reload")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
package/network/services/hostapd/Makefile
package/network/services/hostapd/src/wpa_supplicant/ubus.c

index 1deab4405833be72b85513969eedde223543619c..f6e089ddb3c0f82442c0182c625eb50f2a1bd8b4 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hostapd
-PKG_RELEASE:=7
+PKG_RELEASE:=8
 
 PKG_SOURCE_URL:=http://w1.fi/hostap.git
 PKG_SOURCE_PROTO:=git
index 4a4e4697b9991b24755b8e00c19005f966673f58..5450b24476ed16ac3f3f2f2a13a0c6b35feef3e4 100644 (file)
@@ -181,6 +181,8 @@ void wpas_ubus_add_bss(struct wpa_supplicant *wpa_s)
        char *name;
        int ret;
 
+       if (!wpas_ubus_init())
+               return;
 
        if (asprintf(&name, "wpa_supplicant.%s", wpa_s->ifname) < 0)
                return;