hostapd: re-introduce process tracking

Before commit 60fb4c92b6 ("hostapd: add ubus reload") netifd was
tracking hostapd/wpa_supplicant and restarting wifi in case of a
process crash. Restore this behaviour by tracking the PIDs of
hostapd and wpa_supplicant.
Also make sure hostapd and/or wpa_supplicant have been started before
emmitting ubus calls to them using ubus wait_for.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle
2019-12-05 18:35:36 +01:00
parent 2568db3fff
commit 24b97579d2
2 changed files with 7 additions and 0 deletions

View File

@@ -940,7 +940,10 @@ drv_mac80211_setup() {
}
else
add_ap=1
ubus wait_for hostapd.$phy
ubus call hostapd.${phy} config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}"
local hostapd_pid=$(ubus call service list '{"name": "hostapd"}' | jsonfilter -l 1 -e "@['hostapd'].instances['hostapd-${phy}'].pid")
wireless_add_process "$hostapd_pid" "/usr/sbin/hostapd" 1
fi
ret="$?"
[ "$ret" != 0 ] && {