[packages] multiwan: Tweaked probability for random packet selection
git-svn-id: svn://svn.openwrt.org/openwrt/packages@21415 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b56076fdb1
commit
9ab7bbda14
@ -8,7 +8,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=multiwan
|
PKG_NAME:=multiwan
|
||||||
PKG_VERSION:=1.0.6
|
PKG_VERSION:=1.0.7
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
@ -636,6 +636,7 @@ local weight
|
|||||||
local nexthop
|
local nexthop
|
||||||
local pre_nexthop_chk
|
local pre_nexthop_chk
|
||||||
local rand_probability
|
local rand_probability
|
||||||
|
local last_probability
|
||||||
local total_weight
|
local total_weight
|
||||||
local i
|
local i
|
||||||
|
|
||||||
@ -657,6 +658,7 @@ ip route flush table 123 > /dev/null 2>&1
|
|||||||
done
|
done
|
||||||
|
|
||||||
total_weight=0
|
total_weight=0
|
||||||
|
last_probability=0
|
||||||
|
|
||||||
iptables -F MultiWanLoadBalancer -t mangle
|
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
|
if [ "$gateway" != "x" -a "$ifname" != "x" -a "$failchk" != "x" -a "$weight" != "disable" ]; then
|
||||||
nexthop="$nexthop nexthop via $gateway dev $ifname weight $weight"
|
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
|
if [ $rand_probability -lt 10 ]; then
|
||||||
rand_probability="0.0${rand_probability}"
|
rand_probability="0.0${rand_probability}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user