When dnsmasq is configured with a "domain" option in the "config dnsmasq"
section of /etc/config/dhcp, it causes a "search" line to be added to
/etc/resolv.conf naming the domain specified. For situations where this is
undesirable, this can now be bypassed with the "search_domain" boolean option.
The default, on, produces the current behavior. Setting it to off avoids
adding a "search" line to resolv.conf. "option domain" still retains its other
functions such as providing the value for the --domain option to dnsmasq.

Signed-off-by: Mark Mentovai <m...@moxienet.com>

Index: package/dnsmasq/files/dnsmasq.init
===================================================================
--- package/dnsmasq/files/dnsmasq.init  (revision 31782)
+++ package/dnsmasq/files/dnsmasq.init  (working copy)
@@ -7,6 +7,7 @@
 
 DNS_SERVERS=""
 DOMAIN=""
+SEARCH_DOMAIN=1
 INSERT_LANADDR=1
 
 CONFIGFILE="/var/etc/dnsmasq.conf"
@@ -110,6 +111,7 @@
        append_parm "$cfg" "dhcp_boot" "--dhcp-boot"
 
        config_get DOMAIN "$cfg" domain
+       config_get_bool SEARCH_DOMAIN "$cfg" search_domain 1
        config_get_bool INSERT_LANADDR "$cfg" insert_lanaddr 1
 
        config_get_bool readethers "$cfg" readethers
@@ -460,7 +462,8 @@
 
        service_start /usr/sbin/dnsmasq -C $CONFIGFILE && {
                rm -f /tmp/resolv.conf
-               [ -n "$DOMAIN" ] && echo "search $DOMAIN" >> /tmp/resolv.conf
+               [ "$SEARCH_DOMAIN" -ne 0 ] && [ -n "$DOMAIN" ] &&
+                       echo "search $DOMAIN" >> /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
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to