This patch corrects a few things with the dnsmasq startup script:
 - makes router use dnsmasq for dns lookups
 - adds the search keyword to the /tmp/resolv.conf file
 - correctly kills dnsmasq on stop


Signed-off-by: Ben Pfountz <netprince [at] vt [dot] edu>


diff -urN package.old/dnsmasq/files/dnsmasq.init 
package/dnsmasq/files/dnsmasq.init
--- package.old/dnsmasq/files/dnsmasq.init      2008-10-03 17:27:43.000000000 
-0400
+++ package/dnsmasq/files/dnsmasq.init  2008-10-03 17:35:06.000000000 -0400
@@ -2,7 +2,7 @@
 # Copyright (C) 2007 OpenWrt.org
 
 START=60
-DNS_SERVERS=""
+DNS_DOMAIN=""
 
 dhcp_calc() {
        local ip="$1"
@@ -67,6 +67,7 @@
        config_get leasefile $cfg leasefile
        [ -e "$leasefile" ] || touch "$leasefile"
        config_get_bool cachelocal "$cfg" cachelocal 1
+       config_get DNS_DOMAIN "$cfg" domain
 }
 
 dhcp_subscrid_add() {
@@ -202,11 +203,6 @@
        config_get ifname "$net" ifname
        [ -n "$ifname" ] || return 0
 
-       config_get dnsserver "$net" dns
-       [ "$cachelocal" = "0" -a -n "$dnsserver" ] && {
-               DNS_SERVERS="$DNS_SERVERS $dnsserver"
-       }
-
        append_bool "$cfg" ignore "-2 $ifname"
 
        config_get proto "$net" proto
@@ -268,10 +264,9 @@
 
        /usr/sbin/dnsmasq $args && {
                rm -f /tmp/resolv.conf
-               DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
-               for DNS_SERVER in $DNS_SERVERS ; do
-                       echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf
-               done
+               echo "nameserver 127.0.0.1" > /tmp/resolv.conf
+               [ "$DNS_DOMAIN" != "" ] && \
+                       echo "search $DNS_DOMAIN" >> /tmp/resolv.conf
        }
 }
 
@@ -281,6 +276,6 @@
                ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
        }
 
-       killall dnsmasq
-       return 0
+       kill $(ps -w | grep "/usr/sbin/dnsmasq" | awk '{printf " " $1}')      
2> /dev/null
+       return $?
 }

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to