Browse Source

Merge pull request #4792 from TDT-GmbH/mwan3-fixes

ne/mwan3: feature and fixes
lilik-openwrt-22.03
Hannu Nyman 7 years ago
committed by GitHub
parent
commit
2c80296a6c
3 changed files with 23 additions and 19 deletions
  1. +2
    -2
      net/mwan3/Makefile
  2. +2
    -2
      net/mwan3/files/etc/hotplug.d/iface/14-mwan3
  3. +19
    -15
      net/mwan3/files/usr/sbin/mwan3track

+ 2
- 2
net/mwan3/Makefile View File

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


+ 2
- 2
net/mwan3/files/etc/hotplug.d/iface/14-mwan3 View File

@ -22,7 +22,7 @@ config_get local_source globals local_source 'none'
}
mwan3_lock
src_ip=$(uci -q -P /var/state get mwan3.globals.src_ip 2>/dev/null)
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
@ -37,7 +37,7 @@ usleep 10000
else
ip addr add "${src_ip}/32" dev lo
ip route add default via "${src_ip}" dev lo
uci -q -P /var/state set mwan3.globals.src_ip="${src_ip}"
uci_toggle_state mwan3 globals src_ip "${src_ip}"
fi
}
mwan3_unlock


+ 19
- 15
net/mwan3/files/usr/sbin/mwan3track View File

@ -81,8 +81,8 @@ main() {
local sleep_time=0
local turn=0
if [ "$STATUS" = "offline" ]; then
echo "offline" > /var/run/mwan3track/$1/STATUS
if [ "$STATUS" = "unknown" ]; then
echo "unknown" > /var/run/mwan3track/$1/STATUS
score=0
else
echo "online" > /var/run/mwan3track/$1/STATUS
@ -92,20 +92,24 @@ main() {
sleep_time=$interval
for track_ip in $track_ips; do
case "$track_method" in
ping)
ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null ;;
arping)
arping -I $DEVICE -c $count -w $timeout -q $track_ip &> /dev/null ;;
httping)
httping -y $SRC_IP -c $count -t $timeout -q $track_ip &> /dev/null ;;
esac
if [ $? -eq 0 ]; then
let host_up_count++
echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip}
if [ $host_up_count -lt $reliability ]; then
case "$track_method" in
ping)
ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null ;;
arping)
arping -I $DEVICE -c $count -w $timeout -q $track_ip &> /dev/null ;;
httping)
httping -y $SRC_IP -c $count -t $timeout -q $track_ip &> /dev/null ;;
esac
if [ $? -eq 0 ]; then
let host_up_count++
echo "up" > /var/run/mwan3track/$1/TRACK_${track_ip}
else
let lost++
echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip}
fi
else
let lost++
echo "down" > /var/run/mwan3track/$1/TRACK_${track_ip}
echo "skipped" > /var/run/mwan3track/$1/TRACK_${track_ip}
fi
done


Loading…
Cancel
Save