[packages] multiwan: Changed failover probabilities for
MultiWanLoadBalancer git-svn-id: svn://svn.openwrt.org/openwrt/packages@21414 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
95bec05f00
commit
b56076fdb1
@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=multiwan
|
||||
PKG_VERSION:=1.0.5
|
||||
PKG_VERSION:=1.0.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
@ -664,8 +664,13 @@ i=0
|
||||
while [ $i -lt $wancount ]; do
|
||||
i=`expr $i + 1`
|
||||
group=$(query_config group $i)
|
||||
failchk=$(query_config failchk $group)
|
||||
gateway=$(query_config gateway $group)
|
||||
ifname=$(query_config ifname $group)
|
||||
weight=`uci -q -P /var/state get multiwan.${group}.weight`
|
||||
total_weight=$(expr $total_weight + $weight)
|
||||
if [ "$gateway" != "x" -a "$ifname" != "x" -a "$failchk" != "x" -a "$weight" != "disable" ]; then
|
||||
total_weight=$(expr $total_weight + $weight)
|
||||
fi
|
||||
done
|
||||
|
||||
i=0
|
||||
@ -682,11 +687,13 @@ if [ "$gateway" != "x" -a "$ifname" != "x" -a "$failchk" != "x" -a "$weight" !=
|
||||
nexthop="$nexthop nexthop via $gateway dev $ifname weight $weight"
|
||||
rand_probability=$(expr $(expr $weight \* 100) / $total_weight)
|
||||
|
||||
if [ $rand_probability -lt 10 ]; then
|
||||
rand_probability="0.0${rand_probability}"
|
||||
else
|
||||
rand_probability="0.${rand_probability}"
|
||||
fi
|
||||
if [ $rand_probability -lt 10 ]; then
|
||||
rand_probability="0.0${rand_probability}"
|
||||
elif [ $rand_probability -lt 100 ]; then
|
||||
rand_probability="0.${rand_probability}"
|
||||
else
|
||||
rand_probability="1.0"
|
||||
fi
|
||||
|
||||
if [ -z "$CHKFORMODULE" ]; then
|
||||
iptables -A MultiWanLoadBalancer -t mangle -m mark --mark 0x123 -m statistic --mode random --probability $rand_probability -j FW${i}MARK
|
||||
|
Loading…
x
Reference in New Issue
Block a user