hostapd: improve error handling when adding supplicant config

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2021-01-12 00:28:17 +00:00
parent 7babb978ad
commit 1e2d162092
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_RELEASE:=24
PKG_RELEASE:=25
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git

View File

@ -1392,18 +1392,18 @@ wpa_supplicant_run() {
_wpa_supplicant_common "$ifname"
ubus wait_for wpa_supplicant
local supplicant_pid=$(ubus call wpa_supplicant config_add "{ \
local supplicant_res="$(ubus call wpa_supplicant config_add "{ \
\"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \
\"iface\": \"$ifname\", \"config\": \"$_config\" \
${network_bridge:+, \"bridge\": \"$network_bridge\"} \
${hostapd_ctrl:+, \"hostapd_ctrl\": \"$hostapd_ctrl\"} \
}" | jsonfilter -l 1 -e @.pid)
}")"
ret="$?"
[ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
[ "$ret" != 0 -o -z "$supplicant_res" ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
wireless_add_process "$supplicant_pid" "/usr/sbin/wpa_supplicant" 1 1
wireless_add_process "$(jsonfilter -s "$supplicant_res" -l 1 -e @.pid)" "/usr/sbin/wpa_supplicant" 1 1
return $ret
}