Browse Source

Merge pull request #7093 from TDT-AG/pr/20180924-net-mwan3-update

net/mwan3: some fixes
lilik-openwrt-22.03
Hannu Nyman 6 years ago
committed by GitHub
parent
commit
149ec478de
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 25 deletions
  1. +1
    -1
      net/mwan3/Makefile
  2. +3
    -15
      net/mwan3/files/etc/init.d/mwan3
  3. +9
    -6
      net/mwan3/files/usr/sbin/mwan3
  4. +7
    -3
      net/mwan3/files/usr/sbin/mwan3track

+ 1
- 1
net/mwan3/Makefile View File

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


+ 3
- 15
net/mwan3/files/etc/init.d/mwan3 View File

@ -3,15 +3,7 @@
START=19 START=19
reload() { 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() { boot() {
@ -20,13 +12,9 @@ boot() {
} }
start() { start() {
. /lib/config/uci.sh
uci_toggle_state mwan3 globals enabled "1"
mwan3 start
/usr/sbin/mwan3 start
} }
stop() { stop() {
. /lib/config/uci.sh
uci_toggle_state mwan3 globals enabled "0"
mwan3 stop
/usr/sbin/mwan3 stop
} }

+ 9
- 6
net/mwan3/files/usr/sbin/mwan3 View File

@ -46,6 +46,12 @@ ifup()
local device enabled up l3_device local device enabled up l3_device
config_load mwan3 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 if [ -z "$1" ]; then
echo "Expecting interface. Usage: mwan3 ifup <interface>" && exit 0 echo "Expecting interface. Usage: mwan3 ifup <interface>" && exit 0
@ -123,12 +129,7 @@ start()
{ {
local enabled src_ip local_source 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' config_get local_source globals local_source 'none'
[ "${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 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 ip addr del "${src_ip}/32" dev lo 1>/dev/null 2>&1
} }
uci_toggle_state mwan3 globals enabled "0"
} }
restart() { restart() {


+ 7
- 3
net/mwan3/files/usr/sbin/mwan3track View File

@ -55,6 +55,7 @@ main() {
local recovery_interval down up size local recovery_interval down up size
local keep_failure_interval check_quality failure_latency local keep_failure_interval check_quality failure_latency
local recovery_latency failure_loss recovery_loss local recovery_latency failure_loss recovery_loss
local max_ttl
[ -z "$5" ] && echo "Error: should not be started manually" && exit 0 [ -z "$5" ] && echo "Error: should not be started manually" && exit 0
@ -84,6 +85,7 @@ main() {
config_get down $1 down 5 config_get down $1 down 5
config_get up $1 up 5 config_get up $1 up 5
config_get size $1 size 56 config_get size $1 size 56
config_get max_ttl $1 max_ttl 60
config_get failure_interval $1 failure_interval $interval config_get failure_interval $1 failure_interval $interval
config_get_bool keep_failure_interval $1 keep_failure_interval 0 config_get_bool keep_failure_interval $1 keep_failure_interval 0
config_get recovery_interval $1 recovery_interval $interval config_get recovery_interval $1 recovery_interval $interval
@ -120,10 +122,10 @@ main() {
case "$track_method" in case "$track_method" in
ping) ping)
if [ $check_quality -eq 0 ]; then if [ $check_quality -eq 0 ]; then
ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null
ping -I $DEVICE -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null
result=$? result=$?
else else
ping_result="$(ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip | tail -2)"
ping_result="$(ping -I $DEVICE -c $count -W $timeout -s $size -t $max_ttl -q $track_ip | tail -2)"
loss="$(echo "$ping_result" | grep "packet loss" | cut -d "," -f3 | awk '{print $1}' | sed -e 's/%//')" loss="$(echo "$ping_result" | grep "packet loss" | cut -d "," -f3 | awk '{print $1}' | sed -e 's/%//')"
if [ "$loss" -eq 100 ]; then if [ "$loss" -eq 100 ]; then
latency=999999 latency=999999
@ -237,8 +239,10 @@ main() {
wait wait
if [ "${IFDOWN_EVENT}" -eq 1 ]; then if [ "${IFDOWN_EVENT}" -eq 1 ]; then
score=0
echo "offline" > /var/run/mwan3track/$1/STATUS echo "offline" > /var/run/mwan3track/$1/STATUS
$LOG notice "Interface $1 ($2) is offline"
env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface
score=0
IFDOWN_EVENT=0 IFDOWN_EVENT=0
fi fi
done done


Loading…
Cancel
Save