diff options
author | Florian Eckert <fe@dev.tdt.de> | 2018-08-29 09:19:05 +0200 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2018-09-24 10:20:35 +0200 |
commit | 2cd5442a11a55d91a04e5522db825fb89e2402ee (patch) | |
tree | d450877735bfe0b12201ebc0245dadd2d3e695b8 /net | |
parent | d338131f408cf6402ab2ec9207670f09cdbd803b (diff) |
net/mwan3: fix start/stop/restart execution
Move setting global enabled flag from /etc/init.d/mwan3 to mwan3
command. So we could start mwan3 from the cmd mwan3 as well.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'net')
-rwxr-xr-x | net/mwan3/files/etc/init.d/mwan3 | 18 | ||||
-rwxr-xr-x | net/mwan3/files/usr/sbin/mwan3 | 15 |
2 files changed, 12 insertions, 21 deletions
diff --git a/net/mwan3/files/etc/init.d/mwan3 b/net/mwan3/files/etc/init.d/mwan3 index dac1fb89a..2dccef363 100755 --- a/net/mwan3/files/etc/init.d/mwan3 +++ b/net/mwan3/files/etc/init.d/mwan3 @@ -3,15 +3,7 @@ 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 + /usr/sbin/mwan3 restart } boot() { @@ -20,13 +12,9 @@ boot() { } start() { - . /lib/config/uci.sh - uci_toggle_state mwan3 globals enabled "1" - mwan3 start + /usr/sbin/mwan3 start } stop() { - . /lib/config/uci.sh - uci_toggle_state mwan3 globals enabled "0" - mwan3 stop + /usr/sbin/mwan3 stop } diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 index c10ffa8a5..406804b30 100755 --- a/net/mwan3/files/usr/sbin/mwan3 +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -46,6 +46,12 @@ ifup() local device enabled up l3_device config_load mwan3 + config_get_bool enabled globals 'enabled' 0 + [ ${enabled} -gt 0 ] || { + echo "The service mwan3 is global disabled." + echo "Please execute \"/etc/init.d/mwan3 start\" first." + exit 1 + } if [ -z "$1" ]; then echo "Expecting interface. Usage: mwan3 ifup <interface>" && exit 0 @@ -123,12 +129,7 @@ start() { local enabled src_ip local_source - 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 - } + uci_toggle_state mwan3 globals enabled "1" config_get local_source globals local_source 'none' [ "${local_source}" = "none" ] || { @@ -211,6 +212,8 @@ stop() ip route del default via "${src_ip}" dev lo 1>/dev/null 2>&1 ip addr del "${src_ip}/32" dev lo 1>/dev/null 2>&1 } + + uci_toggle_state mwan3 globals enabled "0" } restart() { |