Currently, dnsmasq removes /tmp/resolv.conf (which is usually a symlink to /tmp/resolv.conf.auto) and creates its own resolv.conf with at least a nameserver pointing to 127.0.0.1.
However, in some cases it might not be desired that the router itself queries its own dnsmasq dns-server but should query the upstream dns server - possibly fetched via an additional, local dhcp client - directly instead. With this new uci configuration option it is possible to prohibit dnsmasq to change /tmp/resolv.conf, leaving it as provided by the udhcpd. Signed-off-by: Linus Lüssing <linus.luess...@web.de> --- package/dnsmasq/files/dhcp.conf | 1 + package/dnsmasq/files/dnsmasq.init | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package/dnsmasq/files/dhcp.conf b/package/dnsmasq/files/dhcp.conf index 5ba772e..aa5f703 100644 --- a/package/dnsmasq/files/dhcp.conf +++ b/package/dnsmasq/files/dhcp.conf @@ -20,6 +20,7 @@ config dnsmasq #list interface br-lan #list notinterface lo #list bogusnxdomain '64.94.110.11' + option resolvconfuntouched 0 config dhcp lan option interface lan diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init index 8334b38..a578649 100644 --- a/package/dnsmasq/files/dnsmasq.init +++ b/package/dnsmasq/files/dnsmasq.init @@ -114,6 +114,8 @@ dnsmasq() { config_get hostsfile "$cfg" dhcphostsfile [ -e "$hostsfile" ] && append args "--dhcp-hostsfile=$hostsfile" + config_get_bool resolvconfuntouched "$cfg" resolvconfuntouched + local rebind config_get_bool rebind "$cfg" rebind_protection 1 [ $rebind -gt 0 ] && { @@ -389,8 +391,9 @@ start() { config_foreach dhcp_srv_add srvhost config_foreach dhcp_add dhcp - /usr/sbin/dnsmasq $args && { + /usr/sbin/dnsmasq $args && [ ! "$resolvconfuntouched" = "1" ] && { rm -f /tmp/resolv.conf + echo "### Created by dnsmasq.init ###" >> /tmp/resolv.conf [ -n "$DOMAIN" ] && echo "search $DOMAIN" >> /tmp/resolv.conf DNS_SERVERS="$DNS_SERVERS 127.0.0.1" for DNS_SERVER in $DNS_SERVERS ; do @@ -400,7 +403,8 @@ start() { } stop() { - [ -f /tmp/resolv.conf ] && { + [ -f /tmp/resolv.conf ] && \ + [ "`head -n1 /tmp/resolv.conf`" = "### Created by dnsmasq.init ###" ] && { rm -f /tmp/resolv.conf ln -s /tmp/resolv.conf.auto /tmp/resolv.conf } -- 1.7.4.1 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel