diff mbox series

[OpenWrt-Devel,18.06,2/2] dnsmasq: prefer localuse over resolvfile guesswork

Message ID 20190223021732.7210-2-yszhou4tech@gmail.com
State Accepted
Headers show
Series None | expand

Commit Message

Yousong Zhou Feb. 23, 2019, 2:17 a.m. UTC
This makes it clear that localuse when explicitly specified in the
config will have its final say on whether or not the initscript should
touch /etc/resolv.conf, no matter whatever the result of previous
guesswork would be

(cherry picked from c17a68cc61a0f8a28e19c7f60b24beaf1a1a402d)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 package/network/services/dnsmasq/Makefile           | 2 +-
 package/network/services/dnsmasq/files/dnsmasq.init | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Hans Dedecker Feb. 23, 2019, 12:25 p.m. UTC | #1
On Sat, Feb 23, 2019 at 3:17 AM Yousong Zhou <yszhou4tech@gmail.com> wrote:
>
> This makes it clear that localuse when explicitly specified in the
> config will have its final say on whether or not the initscript should
> touch /etc/resolv.conf, no matter whatever the result of previous
> guesswork would be
>
> (cherry picked from c17a68cc61a0f8a28e19c7f60b24beaf1a1a402d)
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Acked-by: Hans Dedecker <dedeckeh@gmail.com>
> ---
>  package/network/services/dnsmasq/Makefile           | 2 +-
>  package/network/services/dnsmasq/files/dnsmasq.init | 8 ++++----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
> index c50717d091..eff9cfea24 100644
> --- a/package/network/services/dnsmasq/Makefile
> +++ b/package/network/services/dnsmasq/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=dnsmasq
>  PKG_VERSION:=2.80
> -PKG_RELEASE:=1.3
> +PKG_RELEASE:=1.4
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>  PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
> diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
> index b119981cb8..33ef98ce56 100644
> --- a/package/network/services/dnsmasq/files/dnsmasq.init
> +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> @@ -733,7 +733,7 @@ dnsmasq_start()
>  {
>         local cfg="$1"
>         local disabled user_dhcpscript
> -       local resolvfile localuse
> +       local resolvfile localuse=0
>
>         config_get_bool disabled "$cfg" disabled 0
>         [ "$disabled" -gt 0 ] && return 0
> @@ -883,13 +883,13 @@ dnsmasq_start()
>         config_get_bool cachelocal "$cfg" cachelocal 1
>
>         config_get_bool noresolv "$cfg" noresolv 0
> -       config_get_bool localuse "$cfg" localuse 0
>         if [ "$noresolv" != "1" ]; then
>                 config_get resolvfile "$cfg" resolvfile /tmp/resolv.conf.auto
>                 [ -n "$resolvfile" -a ! -e "$resolvfile" ] && touch "$resolvfile"
>                 xappend "--resolv-file=$resolvfile"
>                 [ "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1
>         fi
> +       config_get_bool localuse "$cfg" localuse "$localuse"
>
>         config_get hostsfile "$cfg" dhcphostsfile
>         [ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
> @@ -1039,13 +1039,13 @@ dnsmasq_start()
>  dnsmasq_stop()
>  {
>         local cfg="$1"
> -       local noresolv resolvfile localuse
> +       local noresolv resolvfile localuse=0
>
>         config_get_bool noresolv "$cfg" noresolv 0
> -       config_get_bool localuse "$cfg" localuse 0
>         config_get resolvfile "$cfg" "resolvfile"
>
>         [ "$noresolv" = 0 -a "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1
> +       config_get_bool localuse "$cfg" localuse "$localuse"
>         [ "$localuse" -gt 0 ] && ln -sf "/tmp/resolv.conf.auto" /tmp/resolv.conf
>
>         rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp
Paul Oranje Feb. 23, 2019, 4:14 p.m. UTC | #2
> Op 23 feb. 2019, om 03:17 heeft Yousong Zhou <yszhou4tech@gmail.com> het volgende geschreven:
> 
> This makes it clear that localuse when explicitly specified in the
> config will have its final say on whether or not the initscript should
> touch /etc/resolv.conf, no matter whatever the result of previous
> guesswork would be
> 
> (cherry picked from c17a68cc61a0f8a28e19c7f60b24beaf1a1a402d)
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Tested-by: Paul Oranje <por@oranjevos.nl>

> ---
> package/network/services/dnsmasq/Makefile           | 2 +-
> package/network/services/dnsmasq/files/dnsmasq.init | 8 ++++----
> 2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
> index c50717d091..eff9cfea24 100644
> --- a/package/network/services/dnsmasq/Makefile
> +++ b/package/network/services/dnsmasq/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
> 
> PKG_NAME:=dnsmasq
> PKG_VERSION:=2.80
> -PKG_RELEASE:=1.3
> +PKG_RELEASE:=1.4
> 
> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
> PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
> diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
> index b119981cb8..33ef98ce56 100644
> --- a/package/network/services/dnsmasq/files/dnsmasq.init
> +++ b/package/network/services/dnsmasq/files/dnsmasq.init
> @@ -733,7 +733,7 @@ dnsmasq_start()
> {
> 	local cfg="$1"
> 	local disabled user_dhcpscript
> -	local resolvfile localuse
> +	local resolvfile localuse=0
> 
> 	config_get_bool disabled "$cfg" disabled 0
> 	[ "$disabled" -gt 0 ] && return 0
> @@ -883,13 +883,13 @@ dnsmasq_start()
> 	config_get_bool cachelocal "$cfg" cachelocal 1
> 
> 	config_get_bool noresolv "$cfg" noresolv 0
> -	config_get_bool localuse "$cfg" localuse 0
> 	if [ "$noresolv" != "1" ]; then
> 		config_get resolvfile "$cfg" resolvfile /tmp/resolv.conf.auto
> 		[ -n "$resolvfile" -a ! -e "$resolvfile" ] && touch "$resolvfile"
> 		xappend "--resolv-file=$resolvfile"
> 		[ "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1
> 	fi
> +	config_get_bool localuse "$cfg" localuse "$localuse"
> 
> 	config_get hostsfile "$cfg" dhcphostsfile
> 	[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
> @@ -1039,13 +1039,13 @@ dnsmasq_start()
> dnsmasq_stop()
> {
> 	local cfg="$1"
> -	local noresolv resolvfile localuse
> +	local noresolv resolvfile localuse=0
> 
> 	config_get_bool noresolv "$cfg" noresolv 0
> -	config_get_bool localuse "$cfg" localuse 0
> 	config_get resolvfile "$cfg" "resolvfile"
> 
> 	[ "$noresolv" = 0 -a "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1
> +	config_get_bool localuse "$cfg" localuse "$localuse"
> 	[ "$localuse" -gt 0 ] && ln -sf "/tmp/resolv.conf.auto" /tmp/resolv.conf
> 
> 	rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp
diff mbox series

Patch

diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index c50717d091..eff9cfea24 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -9,7 +9,7 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.80
-PKG_RELEASE:=1.3
+PKG_RELEASE:=1.4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index b119981cb8..33ef98ce56 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -733,7 +733,7 @@  dnsmasq_start()
 {
 	local cfg="$1"
 	local disabled user_dhcpscript
-	local resolvfile localuse
+	local resolvfile localuse=0
 
 	config_get_bool disabled "$cfg" disabled 0
 	[ "$disabled" -gt 0 ] && return 0
@@ -883,13 +883,13 @@  dnsmasq_start()
 	config_get_bool cachelocal "$cfg" cachelocal 1
 
 	config_get_bool noresolv "$cfg" noresolv 0
-	config_get_bool localuse "$cfg" localuse 0
 	if [ "$noresolv" != "1" ]; then
 		config_get resolvfile "$cfg" resolvfile /tmp/resolv.conf.auto
 		[ -n "$resolvfile" -a ! -e "$resolvfile" ] && touch "$resolvfile"
 		xappend "--resolv-file=$resolvfile"
 		[ "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1
 	fi
+	config_get_bool localuse "$cfg" localuse "$localuse"
 
 	config_get hostsfile "$cfg" dhcphostsfile
 	[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile"
@@ -1039,13 +1039,13 @@  dnsmasq_start()
 dnsmasq_stop()
 {
 	local cfg="$1"
-	local noresolv resolvfile localuse
+	local noresolv resolvfile localuse=0
 
 	config_get_bool noresolv "$cfg" noresolv 0
-	config_get_bool localuse "$cfg" localuse 0
 	config_get resolvfile "$cfg" "resolvfile"
 
 	[ "$noresolv" = 0 -a "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1
+	config_get_bool localuse "$cfg" localuse "$localuse"
 	[ "$localuse" -gt 0 ] && ln -sf "/tmp/resolv.conf.auto" /tmp/resolv.conf
 
 	rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp