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
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
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
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 || {
}
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
}
return
fi
- if [ "${mwan3_startup}" = 1 ]; then
+ if [ "${caller}" = "init" ]; then
hotplug_startup &
hotplug_pids="$hotplug_pids $!"
else