[package] update multiwan to 1.0.18 (#7792)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@23011 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2010-09-11 18:38:29 +00:00
parent c09a4e6d90
commit 33abb314c0
2 changed files with 761 additions and 781 deletions

View File

@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=multiwan PKG_NAME:=multiwan
PKG_VERSION:=1.0.17 PKG_VERSION:=1.0.18
PKG_RELEASE:=0 PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

View File

@ -11,7 +11,7 @@ fi
} }
mwnote() { mwnote() {
logger "[Multi-WAN Notice]: $1" logger ${debug:+-s} -p 5 -t multiwan "$1"
} }
failover() { failover() {
@ -104,8 +104,6 @@ else
fi fi
fi fi
} }
recover_wan() { recover_wan() {
@ -237,7 +235,6 @@ echo "wan_recovery_map=\"$wan_recovery_map\"" >> /tmp/.mwan/cache
} }
query_config() { query_config() {
case $1 in case $1 in
update) update_cache_data;; update) update_cache_data;;
ifname) echo $wan_if_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';; ifname) echo $wan_if_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
@ -251,13 +248,9 @@ esac
} }
mwan_kill() { mwan_kill() {
local otherpids local otherpids=$(ps 2>&1 | grep 'multiwan agent' | grep -v $$ | awk '{print $1}')
local execute [ -n "$otherpids" ] && kill $otherpids > /dev/null 2>&1
otherpids=$(ps -a 2>&1 | grep 'multiwan agent' | grep -v $$ | awk -F " " '{print $1}') sleep 2
echo "$otherpids" | while read execute
do
kill -9 ${execute} > /dev/null 2>&1
done
} }
stop() { stop() {
@ -273,8 +266,8 @@ echo "## Refreshing Interfaces ##"
while [ $i -lt $wancount ]; do while [ $i -lt $wancount ]; do
i=`expr $i + 1` i=`expr $i + 1`
group=$(query_config group $i) group=$(query_config group $i)
fdown $group > /dev/null 2>&1 # ifdown $group > /dev/null 2>&1
ifup $group > /dev/null 2>&1 & ifup $group > /dev/null 2>&1
done done
echo "## Unloaded, updating syslog and exiting. ##" echo "## Unloaded, updating syslog and exiting. ##"
@ -428,11 +421,10 @@ mwanrule() {
config_get src $1 src config_get src $1 src
config_get dst $1 dst config_get dst $1 dst
config_get port_type $1 port_type 'dports'
config_get ports $1 ports config_get ports $1 ports
config_get proto $1 proto config_get proto $1 proto
config_get wanrule $1 wanrule config_get wanrule $1 wanrule
ports_first=${ports%-*}
ports_last=${ports#*-}
if [ -z "$wanrule" ]; then if [ -z "$wanrule" ]; then
return return
@ -454,9 +446,6 @@ mwanrule() {
fi fi
if [ "$ports" == "all" ]; then if [ "$ports" == "all" ]; then
ports=$NULL ports=$NULL
fi
if [ "$ports_first" -ne "$ports_last" ]; then
ports="$ports_first:$ports_last"
fi fi
add_rule() { add_rule() {
if [ "$proto" == "icmp" ]; then if [ "$proto" == "icmp" ]; then
@ -469,7 +458,7 @@ mwanrule() {
${proto:+-p $proto} \ ${proto:+-p $proto} \
${src:+-s $src} \ ${src:+-s $src} \
${dst:+-d $dst} \ ${dst:+-d $dst} \
${ports:+--dport $ports} \ ${ports:+-m multiport --$port_type $ports} \
-j $wanrule -j $wanrule
} }
if [ -z "$proto" -a ! -z "$ports" ]; then if [ -z "$proto" -a ! -z "$ports" ]; then
@ -518,8 +507,7 @@ fi
dns=$(echo $dns | sed -e "s/ /\n/g") dns=$(echo $dns | sed -e "s/ /\n/g")
if [ ! -z "$dns" -a "$failchk" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" -a "$ifname" != "x" ]; then if [ ! -z "$dns" -a "$failchk" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" -a "$ifname" != "x" ]; then
echo "$dns" | while read dns_server echo "$dns" | while read dns_server; do
do
iptables -t mangle -A MultiWanDNS -d $dns_server -p tcp --dport 53 -j FW${i}MARK iptables -t mangle -A MultiWanDNS -d $dns_server -p tcp --dport 53 -j FW${i}MARK
iptables -t mangle -A MultiWanDNS -d $dns_server -p udp --dport 53 -j FW${i}MARK iptables -t mangle -A MultiWanDNS -d $dns_server -p udp --dport 53 -j FW${i}MARK
@ -554,8 +542,7 @@ iptables -t mangle -F FORWARD
iptables -t mangle -F POSTROUTING iptables -t mangle -F POSTROUTING
iptables -t mangle -F OUTPUT iptables -t mangle -F OUTPUT
echo "$IMQ_NFO" | while read execute echo "$IMQ_NFO" | while read execute; do
do
iptables -t mangle -A PREROUTING -i $(echo $execute | awk -F " " '{print $1}') -j IMQ --todev $(echo $execute | awk -F " " '{print $2}') iptables -t mangle -A PREROUTING -i $(echo $execute | awk -F " " '{print $1}') -j IMQ --todev $(echo $execute | awk -F " " '{print $2}')
done done
@ -595,7 +582,7 @@ if [ -z "$CHKFORMODULE" ]; then
iptables -t mangle -A FastBalancer -j MARK --set-mark 0x2 iptables -t mangle -A FastBalancer -j MARK --set-mark 0x2
iptables -t mangle -A FastBalancer -j CONNMARK --save-mark iptables -t mangle -A FastBalancer -j CONNMARK --save-mark
else else
mwnote "Performance load balancer(fastbalanacer) is unavailable due to current kernel limitations.." mwnote "Performance load balancer(fastbalanacer) is unavailable due to current kernel limitations."
iptables -t mangle -A FastBalancer -j MARK --set-mark 0x1 iptables -t mangle -A FastBalancer -j MARK --set-mark 0x1
iptables -t mangle -A FastBalancer -j CONNMARK --save-mark iptables -t mangle -A FastBalancer -j CONNMARK --save-mark
fi fi
@ -659,10 +646,8 @@ echo "## Refreshing Load Balancer ##"
ip rule del prio 9 > /dev/null 2>&1 ip rule del prio 9 > /dev/null 2>&1
ip route flush table 170 > /dev/null 2>&1 ip route flush table 170 > /dev/null 2>&1
for TABLE in 170 for TABLE in 170; do
do ip route | grep -Ev ^default | while read ROUTE; do
ip route | grep -Ev ^default | while read ROUTE
do
ip route add table $TABLE to $ROUTE ip route add table $TABLE to $ROUTE
done done
done done
@ -737,8 +722,7 @@ local i
echo "## Refreshing Routing Tables ##" echo "## Refreshing Routing Tables ##"
i=0 i=0
while [ $i -lt $wancount ] while [ $i -lt $wancount ]; do
do
i=`expr $i + 1` i=`expr $i + 1`
group=$(query_config group $i) group=$(query_config group $i)
gateway=$(query_config gateway $group) gateway=$(query_config gateway $group)
@ -746,10 +730,8 @@ ifname=$(query_config ifname $group)
ipaddr=$(query_config ipaddr $group) ipaddr=$(query_config ipaddr $group)
ip route flush table $(expr $i + 170) > /dev/null 2>&1 ip route flush table $(expr $i + 170) > /dev/null 2>&1
for TABLE in $(expr $i + 170) for TABLE in $(expr $i + 170); do
do ip route | grep -Ev ^default | while read ROUTE; do
ip route | grep -Ev ^default | while read ROUTE
do
ip route add table $TABLE to $ROUTE ip route add table $TABLE to $ROUTE
done done
done done
@ -947,8 +929,7 @@ if [ "$icmp_hosts" != "disable" -a "$ifname" != "x" -a "$ipaddr" != "x" -a "$gat
icmp_hosts=$(echo $icmp_hosts_acquire | sed -e "s/\,/ /g" | sed -e "s/ /\n/g") icmp_hosts=$(echo $icmp_hosts_acquire | sed -e "s/\,/ /g" | sed -e "s/ /\n/g")
ping_test() { ping_test() {
echo "$icmp_hosts" | while read icmp_test_host echo "$icmp_hosts" | while read icmp_test_host; do
do
ping -c 1 -W $timeout -I $ifname $icmp_test_host 2>&1 | grep -o "round-trip" ping -c 1 -W $timeout -I $ifname $icmp_test_host 2>&1 | grep -o "round-trip"
done done
} }
@ -1005,8 +986,7 @@ if [ -f $jobfile ]; then
mv $jobfile $jobfile.work mv $jobfile $jobfile.work
while read LINE while read LINE; do
do
execute_task() { execute_task() {
case $2 in case $2 in