mac80211: improve error handling when adding hostapd config
authorDaniel Golle <daniel@makrotopia.org>
Tue, 12 Jan 2021 00:29:18 +0000 (00:29 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 14 Jan 2021 00:52:50 +0000 (00:52 +0000)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
package/kernel/mac80211/Makefile
package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh

index e03c91e9c4a938d951f82e06a76f7e0e3051786a..096225754c31d023a26e4165d0eacac4450a41ab 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 PKG_NAME:=mac80211
 
 PKG_VERSION:=5.8.18-1
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.8.18/
 PKG_HASH:=f04a8172423c6a945fc7d9844b04f33fda9ae574e552f8f18ee3bdfcfb494563
 
index 7eea198cd91501a99655aabece2a9982efeca930..b4008f3d584757464fddf41eaaa599df2a235a83 100644 (file)
@@ -1019,14 +1019,14 @@ drv_mac80211_setup() {
                if [ "$no_reload" != "0" ]; then
                        add_ap=1
                        ubus wait_for hostapd
-                       local hostapd_pid=$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}" | jsonfilter -l 1 -e @.pid)
-                       wireless_add_process "$hostapd_pid" "/usr/sbin/hostapd" 1 1
+                       local hostapd_res="$(ubus call hostapd config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}")"
+                       ret="$?"
+                       [ "$ret" != 0 -o -z "$hostapd_res" ] && {
+                               wireless_setup_failed HOSTAPD_START_FAILED
+                               return
+                       }
+                       wireless_add_process "$(jsonfilter -s "$hostapd_res" -l 1 -e @.pid)" "/usr/sbin/hostapd" 1 1
                fi
-               ret="$?"
-               [ "$ret" != 0 ] && {
-                       wireless_setup_failed HOSTAPD_START_FAILED
-                       return
-               }
        }
        uci -q -P /var/state set wireless._${phy}.aplist="${NEWAPLIST}"
        uci -q -P /var/state set wireless._${phy}.md5="${NEW_MD5}"