[openwrt/openwrt] hostapd: improve error handling when adding supplicant config

LEDE Commits lede-commits at lists.infradead.org
Wed Jan 13 19:54:15 EST 2021


dangole pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/1e2d162092dd54fc7b285dd89014958786dc2b5a

commit 1e2d162092dd54fc7b285dd89014958786dc2b5a
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Tue Jan 12 00:28:17 2021 +0000

    hostapd: improve error handling when adding supplicant config
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 package/network/services/hostapd/Makefile         | 2 +-
 package/network/services/hostapd/files/hostapd.sh | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index a6d56d1433..a64065db10 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -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
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
 }



More information about the lede-commits mailing list