include $(TOPDIR)/rules.mk
PKG_NAME:=multiwan
-PKG_VERSION:=1.0m
+PKG_VERSION:=1.0.1
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
config 'multiwan' 'config'
option 'default_route' 'balancer'
- option 'resolv_conf' '/tmp/resolv.conf.auto'
config 'interface' 'wan'
option 'weight' '10'
option 'timeout' '3'
option 'health_fail_retries' '3'
option 'health_recovery_retries' '5'
- option 'failover_to' 'balancer'
+ option 'failover_to' 'wan2'
+ option 'dns' 'auto'
config 'interface' 'wan2'
option 'weight' '10'
option 'timeout' '3'
option 'health_fail_retries' '3'
option 'health_recovery_retries' '5'
- option 'failover_to' 'wan3'
-
-config 'interface' 'wan3'
- option 'weight' 'disable'
- option 'health_interval' 'disable'
- option 'icmp_hosts' 'gateway'
- option 'timeout' '3'
- option 'health_fail_retries' '3'
- option 'health_recovery_retries' '5'
- option 'failover_to' 'disable'
-
-config 'interface' 'wan4'
- option 'weight' '3'
- option 'health_interval' '20'
- option 'icmp_hosts' '208.67.222.222 208.67.220.220'
- option 'timeout' '3'
- option 'health_fail_retries' '3'
- option 'health_recovery_retries' '5'
- option 'failover_to' 'wan'
+ option 'failover_to' 'balancer'
+ option 'dns' '208.67.222.222 208.67.220.220'
config 'mwanfw'
option 'src' '192.168.1.0/24'
option 'dst' 'ftp.netlab7.com'
- option 'proto' 'tcp'
- option 'ports' '21'
- option 'wanrule' 'wan4'
-
-config 'mwanfw'
option 'proto' 'tcp'
option 'ports' '21'
option 'wanrule' 'wan2'
local ifname
local failchk
local compile_dns
-local resolv_conf
local dns_server
local i
iptables -F MultiWanDNS -t mangle
-rm $resolv_conf
-touch $resolv_conf
+rm /tmp/resolv.conf.auto
+touch /tmp/resolv.conf.auto
echo "## Refreshing DNS Resolution and Tables ##"
ifname=$(query_config ifname $group)
failchk=$(query_config failchk $group)
+dns=`uci -q -P /var/state get multiwan.${group}.dns`
+
+if [ -z "$dns" -o "$dns" == "auto" ]; then
dns=`uci -q -P /var/state get network.${group}.dns`
+fi
+
dns=$(echo $dns | sed -e "s/ /\n/g")
if [ ! -z "$dns" -a "$failchk" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" -a "$ifname" != "x" ]; then
iptables -t mangle -A MultiWanDNS -d $dns_server -j FW${i}MARK
compile_dns="nameserver $dns_server"
- echo "$compile_dns" >> $resolv_conf
+ echo "$compile_dns" >> /tmp/resolv.conf.auto
done
fi
done
if [ "$icmp_hosts" == "gateway" -o -z "$icmp_hosts" ]; then
icmp_hosts_acquire=$gateway
elif [ "$icmp_hosts" == "dns" ]; then
- icmp_hosts_acquire=`uci -q -P /var/state get network.$1.dns`
+ icmp_hosts_acquire=`uci -q -P /var/state get multiwan.$1.dns`
+ if [ -z "$icmp_hosts_acquire" -o "$icmp_hosts_acquire" == "auto" ]; then
+ icmp_hosts_acquire=`uci -q -P /var/state get network.$1.dns`
+ fi
else
icmp_hosts_acquire=$icmp_hosts
fi
config_clear
config_load "multiwan"
config_get default_route config default_route
-config_get resolv_conf config resolv_conf
config_get debug config debug
config_foreach acquire_wan_data interface