aboutsummaryrefslogtreecommitdiff
path: root/net/coova-chilli/files
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2019-03-18 11:53:23 +0100
committerPetr Štetiar <ynezz@true.cz>2019-09-25 12:59:55 +0200
commit9d3a1a2a6359257f8b29202c149c5bce8b4e89e4 (patch)
tree7ade14a89d64f688a725159646344e5e67404f2e /net/coova-chilli/files
parentaa6dfc5978226e6897559b1e4ffd0f722e2c8bd4 (diff)
coova-chilli: Fix unwanted startup of disabled instances
Code in option_cb was referencing $chilli_inst variable which was declared as local, thus the instance startup logic in start_chilli was referencing variable which would always get value of 1, effectively making `disabled` config option useless. So I've fixed it with simpler config_get_bool and while at it, I've simplified the surrounding code little bit as well. Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'net/coova-chilli/files')
-rw-r--r--net/coova-chilli/files/chilli.init23
1 files changed, 9 insertions, 14 deletions
diff --git a/net/coova-chilli/files/chilli.init b/net/coova-chilli/files/chilli.init
index e30843876..bf34cfc82 100644
--- a/net/coova-chilli/files/chilli.init
+++ b/net/coova-chilli/files/chilli.init
@@ -9,18 +9,15 @@ service_triggers() {
}
config_cb() {
- local chilli_inst="$2"
- if [ "$chilli_inst" != "" ]; then
- chilli_conf="/var/run/chilli_${chilli_inst}.conf"
- if [ -e "$chilli_conf" ]; then
- rm -f "$chilli_conf"
- fi
- eval "start_chilli_$chilli_inst=1"
- fi
+ chilli_conf="/var/run/chilli_${2}.conf"
+ [ -e "$chilli_conf" ] && rm -f "$chilli_conf"
}
option_cb() {
case "$1" in
+ # ignored/internal settings
+ disabled)
+ ;;
# UCI settings
network)
. /lib/functions/network.sh
@@ -28,9 +25,6 @@ option_cb() {
network_get_device ifname "$2"
echo "dhcpif=\"$ifname\"" >> "$chilli_conf"
;;
- disabled)
- [ "$(config_get_bool "$1")" = "1" ] && eval "start_chilli_$chilli_inst=0"
- ;;
# boolean settings
debug|dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|\
locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|\
@@ -51,13 +45,14 @@ option_cb() {
start_chilli() {
local cfg="$1"
- local start_chilli=$(eval "echo \$start_chilli_$cfg")
- [ "$start_chilli" = "0" ] && return
local base="/var/run/chilli_${cfg}"
+ config_get_bool disabled "$1" 'disabled' 1
+ [ $disabled = 1 ] && return
+
procd_open_instance "$cfg"
procd_set_param command /usr/sbin/chilli
- procd_set_param file "${base}.conf"
+ procd_set_param file "$chilli_conf"
procd_append_param command \
--fg \
--conf "${base}.conf" \