From: Craig M. Coffee Date: Thu, 29 Apr 2010 04:35:48 +0000 (+0000) Subject: [packages] multiwan: removed resolv_conf settings and added dns server override ... X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=commitdiff_plain;hb=73f02aca634a05274709cb544e054a2eb995cc45 [packages] multiwan: removed resolv_conf settings and added dns server override & updated default config file. SVN-Revision: 21249 --- diff --git a/net/multiwan/Makefile b/net/multiwan/Makefile index cbe867501f..44e52b82e4 100644 --- a/net/multiwan/Makefile +++ b/net/multiwan/Makefile @@ -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 diff --git a/net/multiwan/files/etc/config/multiwan b/net/multiwan/files/etc/config/multiwan index 5a28410c84..430522cfea 100644 --- a/net/multiwan/files/etc/config/multiwan +++ b/net/multiwan/files/etc/config/multiwan @@ -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,34 +19,12 @@ 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' diff --git a/net/multiwan/files/usr/bin/multiwan b/net/multiwan/files/usr/bin/multiwan index 5b2ba76d80..d7da6ad7d6 100755 --- a/net/multiwan/files/usr/bin/multiwan +++ b/net/multiwan/files/usr/bin/multiwan @@ -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