diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index c3bf5ee68..b1a2bec94 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 -PKG_VERSION:=2.6.10 -PKG_RELEASE:=2 +PKG_VERSION:=2.6.11 +PKG_RELEASE:=1 PKG_MAINTAINER:=Florian Eckert PKG_LICENSE:=GPLv2 diff --git a/net/mwan3/files/etc/mwan3.user b/net/mwan3/files/etc/mwan3.user index 3c1f9fb7a..39989ab9b 100644 --- a/net/mwan3/files/etc/mwan3.user +++ b/net/mwan3/files/etc/mwan3.user @@ -7,6 +7,10 @@ # # There are three main environment variables that are passed to this script. # -# $ACTION Either "ifup" or "ifdown" +# $ACTION +# Is called by netifd and mwan3track +# Is called by netifd and mwan3track +# Is only called by mwan3track if tracking was successful +# Is only called by mwan3track if tracking has failed # $INTERFACE Name of the interface which went up or down (e.g. "wan" or "wwan") # $DEVICE Physical device name which interface went up or down (e.g. "eth0" or "wwan0") diff --git a/net/mwan3/files/lib/mwan3/mwan3.sh b/net/mwan3/files/lib/mwan3/mwan3.sh index 7a4f1f2c8..275723008 100644 --- a/net/mwan3/files/lib/mwan3/mwan3.sh +++ b/net/mwan3/files/lib/mwan3/mwan3.sh @@ -10,6 +10,7 @@ CONNTRACK_FILE="/proc/net/nf_conntrack" MWAN3_STATUS_DIR="/var/run/mwan3" MWAN3TRACK_STATUS_DIR="/var/run/mwan3track" +MWAN3_INTERFACE_MAX="" DEFAULT_LOWEST_METRIC=256 MMX_MASK="" MMX_DEFAULT="" @@ -58,18 +59,25 @@ mwan3_id2mask() mwan3_init() { local bitcnt - local mmdefault mmblackhole mmunreachable + local mmdefault [ -d $MWAN3_STATUS_DIR ] || mkdir -p $MWAN3_STATUS_DIR/iface_state # mwan3's MARKing mask (at least 3 bits should be set) if [ -e "${MWAN3_STATUS_DIR}/mmx_mask" ]; then MMX_MASK=$(cat "${MWAN3_STATUS_DIR}/mmx_mask") + MWAN3_INTERFACE_MAX=$(uci_get_state mwan3 globals iface_max) else config_load mwan3 config_get MMX_MASK globals mmx_mask '0xff00' echo "$MMX_MASK" > "${MWAN3_STATUS_DIR}/mmx_mask" $LOG notice "Using firewall mask ${MMX_MASK}" + + bitcnt=$(mwan3_count_one_bits MMX_MASK) + mmdefault=$(((1<0) if($i+0<255) {print;break}}'); do + for route in $(seq 1 $MWAN3_INTERFACE_MAX); do $IP route flush table $route &> /dev/null done diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 2e6f0ffdd..e8080b59c 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -142,6 +142,7 @@ main() { echo "offline" > /var/run/mwan3track/$1/STATUS $LOG notice "Interface $1 ($2) is offline" env -i ACTION=ifdown INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface + env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface score=0 fi else @@ -162,6 +163,7 @@ main() { if [ $score -eq $up ]; then $LOG notice "Interface $1 ($2) is online" echo "online" > /var/run/mwan3track/$1/STATUS + env -i ACTION="connected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface env -i ACTION=ifup INTERFACE=$1 DEVICE=$2 /sbin/hotplug-call iface exit 0 fi