fi
config_load mwan3
+config_get_bool enabled globals 'enabled' '0'
+[ ${enabled} -gt 0 ] || exit 0
+
config_get local_source globals local_source 'none'
[ "${local_source}" = "none" ] && {
exit 0
[ -n "$DEVICE" ] || exit 3
fi
-mwan3_lock
-mwan3_set_connected_iptables
-mwan3_unlock
-
config_load mwan3
+config_get_bool enabled globals 'enabled' '0'
+[ ${enabled} -gt 0 ] || exit 0
+
config_get enabled $INTERFACE enabled 0
config_get initial_state $INTERFACE initial_state "online"
[ "$enabled" == "1" ] || exit 0
+mwan3_lock
+mwan3_set_connected_iptables
+mwan3_unlock
+
if [ "$ACTION" == "ifup" ]; then
config_get family $INTERFACE family ipv4
if [ "$family" = "ipv4" ]; then
. /lib/functions.sh
config_load mwan3
+ config_get_bool enabled globals 'enabled' '0'
+ [ ${enabled} -gt 0 ] || exit 0
+
config_get enabled "$INTERFACE" enabled 0
[ "${enabled}" = "1" ] || exit 0
env -i ACTION="$ACTION" INTERFACE="$INTERFACE" DEVICE="$DEVICE" \
--- /dev/null
+#!/bin/sh /etc/rc.common
+
+START=19
+
+reload() {
+ local enabled
+
+ config_load mwan3
+ config_get_bool enabled globals 'enabled' 0
+ [ ${enabled} -gt 0 ] || {
+ echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
+ exit 0
+ }
+ mwan3 restart
+}
+
+boot() {
+ . /lib/config/uci.sh
+ uci_toggle_state mwan3 globals enabled "1"
+}
+
+start() {
+ . /lib/config/uci.sh
+ uci_toggle_state mwan3 globals enabled "1"
+ mwan3 start
+}
+
+stop() {
+ . /lib/config/uci.sh
+ uci_toggle_state mwan3 globals enabled "0"
+ mwan3 stop
+}
echo "Too many arguments. Usage: mwan3 ifup <interface>" && exit 0
fi
+ config_get_bool enabled globals 'enabled' 0
+ [ ${enabled} -gt 0 ] || {
+ echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
+ exit 0
+ }
+
config_get enabled "$1" enabled 0
device=$(uci -p /var/state get network.$1.ifname) &> /dev/null
start()
{
+ local enabled
+
config_load mwan3
+ config_get_bool enabled globals 'enabled' 0
+ [ ${enabled} -gt 0 ] || {
+ echo "Warning: mwan3 is global disabled. Usage: /etc/init.d/mwan3 start"
+ exit 0
+ }
+
config_foreach ifup interface
}