[packages] multiwan: removed resolv_conf settings and added dns server override ...
authorcraigc <craigc@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 29 Apr 2010 04:35:48 +0000 (04:35 +0000)
committercraigc <craigc@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 29 Apr 2010 04:35:48 +0000 (04:35 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@21249 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/multiwan/Makefile
net/multiwan/files/etc/config/multiwan
net/multiwan/files/usr/bin/multiwan

index cbe8675..44e52b8 100644 (file)
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=multiwan
-PKG_VERSION:=1.0m
+PKG_VERSION:=1.0.1
 PKG_RELEASE:=1
 
 include $(INCLUDE_DIR)/package.mk
index 5a28410..430522c 100644 (file)
@@ -1,7 +1,6 @@
 
 config 'multiwan' 'config'
        option 'default_route' 'balancer'
-       option 'resolv_conf' '/tmp/resolv.conf.auto'
 
 config 'interface' 'wan'
        option 'weight' '10'
@@ -10,7 +9,8 @@ config 'interface' 'wan'
        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'
@@ -19,36 +19,14 @@ config 'interface' 'wan2'
        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'
 
 config 'mwanfw'
index 5b2ba76..d7da6ad 100755 (executable)
@@ -445,14 +445,13 @@ local gateway
 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 ##"
 
@@ -465,7 +464,12 @@ ipaddr=$(query_config ipaddr $group)
 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
@@ -474,7 +478,7 @@ do
        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
@@ -832,7 +836,10 @@ if [ "$icmp_hosts" != "disable" -a "$ifname" != "x" -a "$ipaddr" != "x" -a "$gat
        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
@@ -940,7 +947,6 @@ wancount=0
 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