diff options
author | Daniel Golle <daniel@makrotopia.org> | 2020-04-06 23:58:40 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2020-04-14 00:22:21 +0100 |
commit | f37d6342367b4f8393f9693edd96b12dfa016399 (patch) | |
tree | 39814f5b920a29263d3d25bd9991a4e906297b8b /package/network/services/hostapd/files | |
parent | 35f208da3c13cc16227f229f8aea14c4f0a06928 (diff) | |
download | upstream-f37d6342367b4f8393f9693edd96b12dfa016399.tar.gz upstream-f37d6342367b4f8393f9693edd96b12dfa016399.tar.bz2 upstream-f37d6342367b4f8393f9693edd96b12dfa016399.zip |
hostapd: reduce to a single instance per service
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.hotplug | 46 | ||||
-rw-r--r-- | package/network/services/hostapd/files/hostapd.sh | 6 | ||||
-rw-r--r-- | package/network/services/hostapd/files/wpad.init | 25 |
3 files changed, 28 insertions, 49 deletions
diff --git a/package/network/services/hostapd/files/hostapd.hotplug b/package/network/services/hostapd/files/hostapd.hotplug deleted file mode 100644 index 2c936fde75..0000000000 --- a/package/network/services/hostapd/files/hostapd.hotplug +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -initscript="$0" - -. /lib/functions.sh -. /lib/functions/procd.sh - -cd /sys/class/ieee80211 - -procd_lock() { - return 0 -} - -service_triggers() { - return 0 -} - -service_data() { - return 0 -} - -procd_open_service hostapd - -for phy in *; do - [ -d "$phy" ] || continue - - mkdir -p /var/run/wpa_supplicant-$phy /var/run/hostapd-$phy - - if [ -x "/usr/sbin/hostapd" ]; then - procd_open_instance hostapd-$phy - procd_set_param command /usr/sbin/hostapd -s -n $phy -g /var/run/hostapd-${phy}/global - procd_set_param CREATE_TIME="$(date -r $phy)" # force restart on recreated phy - procd_set_param respawn - procd_close_instance - fi - - if [ -x "/usr/sbin/wpa_supplicant" ]; then - procd_open_instance supplicant-$phy - procd_set_param command /usr/sbin/wpa_supplicant -s -n $phy -g /var/run/wpa_supplicant-${phy}/global - procd_set_param CREATE_TIME="$(date -r $phy)" # force restart on recreated phy - procd_set_param respawn - procd_close_instance - fi -done - -procd_close_service set diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 542056fe9a..637f298ad9 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -1075,8 +1075,8 @@ wpa_supplicant_run() { _wpa_supplicant_common "$ifname" - ubus wait_for wpa_supplicant.$phy - ubus call wpa_supplicant.$phy config_add "{ \ + ubus wait_for wpa_supplicant + ubus call wpa_supplicant config_add "{ \ \"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \ \"iface\": \"$ifname\", \"config\": \"$_config\" \ ${network_bridge:+, \"bridge\": \"$network_bridge\"} \ @@ -1087,7 +1087,7 @@ wpa_supplicant_run() { [ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED - local supplicant_pid=$(ubus call service list '{"name": "hostapd"}' | jsonfilter -l 1 -e "@['hostapd'].instances['supplicant-${phy}'].pid") + local supplicant_pid=$(ubus call service list '{"name": "hostapd"}' | jsonfilter -l 1 -e "@['hostapd'].instances['supplicant'].pid") wireless_add_process "$supplicant_pid" "/usr/sbin/wpa_supplicant" 1 return $ret diff --git a/package/network/services/hostapd/files/wpad.init b/package/network/services/hostapd/files/wpad.init new file mode 100644 index 0000000000..3198e9801f --- /dev/null +++ b/package/network/services/hostapd/files/wpad.init @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common + +START=19 +STOP=21 + +USE_PROCD=1 +NAME=wpad + +start_service() { + if [ -x "/usr/sbin/hostapd" ]; then + mkdir -p /var/run/hostapd + procd_open_instance hostapd + procd_set_param command /usr/sbin/hostapd -s -g /var/run/hostapd/global + procd_set_param respawn + procd_close_instance + fi + + if [ -x "/usr/sbin/wpa_supplicant" ]; then + mkdir -p /var/run/wpa_supplicant + procd_open_instance supplicant + procd_set_param command /usr/sbin/wpa_supplicant -n -s -g /var/run/wpa_supplicant/global + procd_set_param respawn + procd_close_instance + fi +} |