Browse Source

Merge pull request #7773 from TDT-AG/pr/20181225-mwan3

mwan3: code cleanup
lilik-openwrt-22.03
Hannu Nyman 6 years ago
committed by GitHub
parent
commit
545ee10043
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 34 deletions
  1. +1
    -1
      net/mwan3/Makefile
  2. +2
    -33
      net/mwan3/files/usr/sbin/mwan3

+ 1
- 1
net/mwan3/Makefile View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mwan3
PKG_VERSION:=2.7.7
PKG_VERSION:=2.7.8
PKG_RELEASE:=1
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
PKG_LICENSE:=GPLv2


+ 2
- 33
net/mwan3/files/usr/sbin/mwan3 View File

@ -61,12 +61,6 @@ ifup()
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
}
status=$(ubus -S call network.interface.$1 status)
[ -n "$status" ] && {
json_load $status
@ -75,7 +69,6 @@ ifup()
config_get enabled "$1" enabled 0
if [ "$up" = "1" ] \
&& [ -n "$l3_device" ] \
&& [ "$enabled" = "1" ]; then
@ -132,34 +125,16 @@ status()
start()
{
local enabled src_ip local_source
local enabled
uci_toggle_state mwan3 globals enabled "1"
config_get local_source globals local_source 'none'
[ "${local_source}" = "none" ] || {
src_ip=$(uci_get_state mwan3 globals src_ip)
[ "${src_ip}" != "" ] && {
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
}
network_get_ipaddr src_ip "${local_source}"
if [ "${src_ip}" = "" ]; then
$LOG warn "Unable to set source ip for own initiated traffic (${local_source})"
else
ip addr add "${src_ip}/32" dev lo
ip route add default via "${src_ip}" dev lo
uci_toggle_state mwan3 globals src_ip "${src_ip}"
fi
}
config_foreach ifup interface
}
stop()
{
local ipset route rule table IP IPT pid src_ip
local ipset route rule table IP IPT pid
for pid in $(pgrep -f "mwan3rtmon"); do
kill -TERM "$pid" > /dev/null 2>&1
@ -212,12 +187,6 @@ stop()
mwan3_lock_clean
rm -rf $MWAN3_STATUS_DIR $MWAN3TRACK_STATUS_DIR
src_ip=$(uci_get_state mwan3 globals src_ip)
[ "${src_ip}" = "" ] || {
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"
}


Loading…
Cancel
Save