aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-01-12 00:28:17 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-01-14 00:52:49 +0000
commit1e2d162092dd54fc7b285dd89014958786dc2b5a (patch)
treeca669a2f8755eb1cde6e5d90eca7cb5f902d5043 /package/network/services/hostapd/files
parent7babb978ad9d7fc29acb1ff86afb1eb343af303a (diff)
downloadupstream-1e2d162092dd54fc7b285dd89014958786dc2b5a.tar.gz
upstream-1e2d162092dd54fc7b285dd89014958786dc2b5a.tar.bz2
upstream-1e2d162092dd54fc7b285dd89014958786dc2b5a.zip
hostapd: improve error handling when adding supplicant config
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/network/services/hostapd/files')
-rw-r--r--package/network/services/hostapd/files/hostapd.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index cee9a8eaa2..a48e8d0766 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -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
}