|
@ -45,30 +45,39 @@ ifup() |
|
|
{ |
|
|
{ |
|
|
local device enabled up l3_device status |
|
|
local device enabled up l3_device status |
|
|
|
|
|
|
|
|
|
|
|
mwan3_lock "command" "mwan3" |
|
|
|
|
|
|
|
|
config_load mwan3 |
|
|
config_load mwan3 |
|
|
config_get_bool enabled globals 'enabled' 0 |
|
|
config_get_bool enabled globals 'enabled' 0 |
|
|
|
|
|
|
|
|
[ ${enabled} -gt 0 ] || { |
|
|
[ ${enabled} -gt 0 ] || { |
|
|
echo "The service mwan3 is global disabled." |
|
|
echo "The service mwan3 is global disabled." |
|
|
echo "Please execute \"/etc/init.d/mwan3 start\" first." |
|
|
echo "Please execute \"/etc/init.d/mwan3 start\" first." |
|
|
|
|
|
mwan3_unlock "command" "mwan3" |
|
|
exit 1 |
|
|
exit 1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then |
|
|
if [ -z "$1" ]; then |
|
|
echo "Expecting interface. Usage: mwan3 ifup <interface>" && exit 0 |
|
|
|
|
|
|
|
|
echo "Expecting interface. Usage: mwan3 ifup <interface>" |
|
|
|
|
|
mwan3_unlock "command" "mwan3" |
|
|
|
|
|
exit 0 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
if [ -n "$2" ]; then |
|
|
if [ -n "$2" ]; then |
|
|
echo "Too many arguments. Usage: mwan3 ifup <interface>" && exit 0 |
|
|
|
|
|
|
|
|
echo "Too many arguments. Usage: mwan3 ifup <interface>" |
|
|
|
|
|
mwan3_unlock "command" "mwan3" |
|
|
|
|
|
exit 0 |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
config_get enabled "$1" enabled 0 |
|
|
|
|
|
mwan3_unlock "command" "mwan3" |
|
|
|
|
|
|
|
|
status=$(ubus -S call network.interface.$1 status) |
|
|
status=$(ubus -S call network.interface.$1 status) |
|
|
[ -n "$status" ] && { |
|
|
[ -n "$status" ] && { |
|
|
json_load "$status" |
|
|
json_load "$status" |
|
|
json_get_vars up l3_device |
|
|
json_get_vars up l3_device |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
config_get enabled "$1" enabled 0 |
|
|
|
|
|
|
|
|
|
|
|
if [ "$up" = "1" ] \ |
|
|
if [ "$up" = "1" ] \ |
|
|
&& [ -n "$l3_device" ] \ |
|
|
&& [ -n "$l3_device" ] \ |
|
|
&& [ "$enabled" = "1" ]; then |
|
|
&& [ "$enabled" = "1" ]; then |
|
@ -130,7 +139,9 @@ start() |
|
|
{ |
|
|
{ |
|
|
local enabled |
|
|
local enabled |
|
|
|
|
|
|
|
|
|
|
|
mwan3_lock "command" "mwan3" |
|
|
uci_toggle_state mwan3 globals enabled "1" |
|
|
uci_toggle_state mwan3 globals enabled "1" |
|
|
|
|
|
mwan3_unlock "command" "mwan3" |
|
|
|
|
|
|
|
|
config_load mwan3 |
|
|
config_load mwan3 |
|
|
config_foreach ifup interface |
|
|
config_foreach ifup interface |
|
@ -141,6 +152,7 @@ stop() |
|
|
local ipset route rule table IP IPT pid |
|
|
local ipset route rule table IP IPT pid |
|
|
|
|
|
|
|
|
mwan3_lock "command" "mwan3" |
|
|
mwan3_lock "command" "mwan3" |
|
|
|
|
|
uci_toggle_state mwan3 globals enabled "0" |
|
|
|
|
|
|
|
|
for pid in $(pgrep -f "mwan3rtmon"); do |
|
|
for pid in $(pgrep -f "mwan3rtmon"); do |
|
|
kill -TERM "$pid" > /dev/null 2>&1 |
|
|
kill -TERM "$pid" > /dev/null 2>&1 |
|
@ -198,10 +210,7 @@ stop() |
|
|
|
|
|
|
|
|
mwan3_unlock "command" "mwan3" |
|
|
mwan3_unlock "command" "mwan3" |
|
|
|
|
|
|
|
|
mwan3_lock_clean |
|
|
|
|
|
rm -rf $MWAN3_STATUS_DIR $MWAN3TRACK_STATUS_DIR |
|
|
rm -rf $MWAN3_STATUS_DIR $MWAN3TRACK_STATUS_DIR |
|
|
|
|
|
|
|
|
uci_toggle_state mwan3 globals enabled "0" |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
restart() { |
|
|
restart() { |
|
|