From fd1cc0b21a60cdd96e2cca7fec47d25d0287d7c9 Mon Sep 17 00:00:00 2001 From: "Craig M. Coffee" Date: Mon, 10 May 2010 15:19:34 +0000 Subject: [PATCH] multiwan: Tweaked probability for random packet selection SVN-Revision: 21415 --- net/multiwan/Makefile | 2 +- net/multiwan/files/usr/bin/multiwan | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/net/multiwan/Makefile b/net/multiwan/Makefile index 9948753b2..d7c98dfbe 100644 --- a/net/multiwan/Makefile +++ b/net/multiwan/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=multiwan -PKG_VERSION:=1.0.6 +PKG_VERSION:=1.0.7 PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk diff --git a/net/multiwan/files/usr/bin/multiwan b/net/multiwan/files/usr/bin/multiwan index 78eb86c2b..7e5a735b7 100755 --- a/net/multiwan/files/usr/bin/multiwan +++ b/net/multiwan/files/usr/bin/multiwan @@ -636,6 +636,7 @@ local weight local nexthop local pre_nexthop_chk local rand_probability +local last_probability local total_weight local i @@ -657,6 +658,7 @@ ip route flush table 123 > /dev/null 2>&1 done total_weight=0 +last_probability=0 iptables -F MultiWanLoadBalancer -t mangle @@ -685,7 +687,8 @@ weight=`uci -q -P /var/state get multiwan.${group}.weight` if [ "$gateway" != "x" -a "$ifname" != "x" -a "$failchk" != "x" -a "$weight" != "disable" ]; then nexthop="$nexthop nexthop via $gateway dev $ifname weight $weight" -rand_probability=$(expr $(expr $weight \* 100) / $total_weight) +rand_probability=$(expr $(expr $weight \* 100) / $total_weight + $last_probability) +last_probability=$rand_probability if [ $rand_probability -lt 10 ]; then rand_probability="0.0${rand_probability}" -- 2.30.2