aboutsummaryrefslogtreecommitdiff
path: root/net/mwan3/files
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2020-11-04 16:24:55 +0100
committerFlorian Eckert <fe@dev.tdt.de>2020-11-06 10:41:28 +0100
commit1f1d21ed28c7e6713fb010e380b8557a9d020b16 (patch)
tree6aeb4648e67000dd606e9708ed7781e3c6e9cca4 /net/mwan3/files
parent59d12598b50edbc5a7a1f178c3c291524bd85b13 (diff)
mwan3: make it clearer who initiated the start
It was somewhat opaque how the variable a is questioned. To show this better the variable is now a string and not a boolean. So you can see directly what should happen. With a boolean you always have to think about what it means when 0 or 1 is used. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'net/mwan3/files')
-rw-r--r--net/mwan3/files/etc/hotplug.d/iface/15-mwan34
-rw-r--r--net/mwan3/files/etc/init.d/mwan32
-rw-r--r--net/mwan3/files/lib/mwan3/mwan3.sh12
-rw-r--r--net/mwan3/files/usr/sbin/mwan32
4 files changed, 10 insertions, 10 deletions
diff --git a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3
index 5fe3e33e0..f1755d26f 100644
--- a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3
+++ b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3
@@ -23,7 +23,7 @@ fi
config_load mwan3
/etc/init.d/mwan3 running || {
- [ "$MWAN3_STARTUP" = 1 ] || procd_lock
+ [ "$MWAN3_STARTUP" = "init" ] || procd_lock
LOG notice "mwan3 hotplug $ACTION on $INTERFACE not called because globally disabled"
mwan3_flush_conntrack "$INTERFACE" "$ACTION"
exit 0
@@ -69,7 +69,7 @@ case "$ACTION" in
mwan3_create_iface_iptables $INTERFACE $DEVICE
mwan3_create_iface_rules $INTERFACE $DEVICE
mwan3_set_iface_hotplug_state $INTERFACE "$status"
- if [ "$MWAN3_STARTUP" != 1 ]; then
+ if [ "$MWAN3_STARTUP" = "cmd" ]; then
mwan3_create_iface_route $INTERFACE $DEVICE
mwan3_set_general_rules
[ "$status" = "online" ] && mwan3_set_policies_iptables
diff --git a/net/mwan3/files/etc/init.d/mwan3 b/net/mwan3/files/etc/init.d/mwan3
index bd1ea7260..23c21ab5d 100644
--- a/net/mwan3/files/etc/init.d/mwan3
+++ b/net/mwan3/files/etc/init.d/mwan3
@@ -36,7 +36,7 @@ start_service() {
mwan3_set_custom_ipset
mwan3_set_general_rules
mwan3_set_general_iptables
- config_foreach mwan3_ifup interface 1
+ config_foreach mwan3_ifup interface "init"
wait $hotplug_pids
mwan3_set_policies_iptables
mwan3_set_user_rules
diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh
index 8a5fe6f0d..43740e2de 100644
--- a/net/mwan3/files/lib/mwan3/mwan3.sh
+++ b/net/mwan3/files/lib/mwan3/mwan3.sh
@@ -955,12 +955,12 @@ mwan3_interface_shutdown()
mwan3_ifup()
{
- local up l3_device status interface true_iface mwan3_startup
+ local interface=$1
+ local caller=$2
- interface=$1
- mwan3_startup=$2
+ local up l3_device status true_iface
- if [ "${mwan3_startup}" != 1 ]; then
+ if [ "${caller}" = "cmd" ]; then
# It is not necessary to obtain a lock here, because it is obtained in the hotplug
# script, but we still want to do the check to print a useful error message
/etc/init.d/mwan3 running || {
@@ -979,7 +979,7 @@ mwan3_ifup()
}
hotplug_startup()
{
- env -i MWAN3_STARTUP=$mwan3_startup ACTION=ifup \
+ env -i MWAN3_STARTUP=$caller ACTION=ifup \
INTERFACE=$interface DEVICE=$l3_device \
sh /etc/hotplug.d/iface/15-mwan3
}
@@ -988,7 +988,7 @@ mwan3_ifup()
return
fi
- if [ "${mwan3_startup}" = 1 ]; then
+ if [ "${caller}" = "init" ]; then
hotplug_startup &
hotplug_pids="$hotplug_pids $!"
else
diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3
index 45776bdfc..803e74b9a 100644
--- a/net/mwan3/files/usr/sbin/mwan3
+++ b/net/mwan3/files/usr/sbin/mwan3
@@ -54,7 +54,7 @@ ifup() {
exit 0
fi
- mwan3_ifup "$1"
+ mwan3_ifup "$1" "cmd"
}
interfaces()