aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211/files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-01-12 00:29:18 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-01-14 00:52:50 +0000
commitd9d698843469ee24de01fbb498bd8690d69b8b61 (patch)
treed550833284aa318ceade179901e65007cb7c6a0d /package/kernel/mac80211/files
parent1e2d162092dd54fc7b285dd89014958786dc2b5a (diff)
downloadupstream-d9d698843469ee24de01fbb498bd8690d69b8b61.tar.gz
upstream-d9d698843469ee24de01fbb498bd8690d69b8b61.tar.bz2
upstream-d9d698843469ee24de01fbb498bd8690d69b8b61.zip
mac80211: improve error handling when adding hostapd config
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/kernel/mac80211/files')
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 7eea198cd9..b4008f3d58 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -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}"