dnsmasq: prefer localuse over resolvfile guesswork
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 Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
This commit is contained in:
		| @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk | |||||||
| PKG_NAME:=dnsmasq | PKG_NAME:=dnsmasq | ||||||
| PKG_UPSTREAM_VERSION:=2.80 | PKG_UPSTREAM_VERSION:=2.80 | ||||||
| PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) | PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) | ||||||
| PKG_RELEASE:=9 | PKG_RELEASE:=10 | ||||||
|  |  | ||||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz | PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz | ||||||
| PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq | PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq | ||||||
|   | |||||||
| @@ -733,7 +733,7 @@ dnsmasq_start() | |||||||
| { | { | ||||||
| 	local cfg="$1" | 	local cfg="$1" | ||||||
| 	local disabled user_dhcpscript | 	local disabled user_dhcpscript | ||||||
| 	local resolvfile localuse | 	local resolvfile localuse=0 | ||||||
|  |  | ||||||
| 	config_get_bool disabled "$cfg" disabled 0 | 	config_get_bool disabled "$cfg" disabled 0 | ||||||
| 	[ "$disabled" -gt 0 ] && return 0 | 	[ "$disabled" -gt 0 ] && return 0 | ||||||
| @@ -884,13 +884,13 @@ dnsmasq_start() | |||||||
| 	config_get_bool cachelocal "$cfg" cachelocal 1 | 	config_get_bool cachelocal "$cfg" cachelocal 1 | ||||||
|  |  | ||||||
| 	config_get_bool noresolv "$cfg" noresolv 0 | 	config_get_bool noresolv "$cfg" noresolv 0 | ||||||
| 	config_get_bool localuse "$cfg" localuse 0 |  | ||||||
| 	if [ "$noresolv" != "1" ]; then | 	if [ "$noresolv" != "1" ]; then | ||||||
| 		config_get resolvfile "$cfg" resolvfile /tmp/resolv.conf.auto | 		config_get resolvfile "$cfg" resolvfile /tmp/resolv.conf.auto | ||||||
| 		[ -n "$resolvfile" -a ! -e "$resolvfile" ] && touch "$resolvfile" | 		[ -n "$resolvfile" -a ! -e "$resolvfile" ] && touch "$resolvfile" | ||||||
| 		xappend "--resolv-file=$resolvfile" | 		xappend "--resolv-file=$resolvfile" | ||||||
| 		[ "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1 | 		[ "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1 | ||||||
| 	fi | 	fi | ||||||
|  | 	config_get_bool localuse "$cfg" localuse "$localuse" | ||||||
|  |  | ||||||
| 	config_get hostsfile "$cfg" dhcphostsfile | 	config_get hostsfile "$cfg" dhcphostsfile | ||||||
| 	[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile" | 	[ -e "$hostsfile" ] && xappend "--dhcp-hostsfile=$hostsfile" | ||||||
| @@ -1040,13 +1040,13 @@ dnsmasq_start() | |||||||
| dnsmasq_stop() | dnsmasq_stop() | ||||||
| { | { | ||||||
| 	local cfg="$1" | 	local cfg="$1" | ||||||
| 	local noresolv resolvfile localuse | 	local noresolv resolvfile localuse=0 | ||||||
|  |  | ||||||
| 	config_get_bool noresolv "$cfg" noresolv 0 | 	config_get_bool noresolv "$cfg" noresolv 0 | ||||||
| 	config_get_bool localuse "$cfg" localuse 0 |  | ||||||
| 	config_get resolvfile "$cfg" "resolvfile" | 	config_get resolvfile "$cfg" "resolvfile" | ||||||
|  |  | ||||||
| 	[ "$noresolv" = 0 -a "$resolvfile" = "/tmp/resolv.conf.auto" ] && localuse=1 | 	[ "$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 | 	[ "$localuse" -gt 0 ] && ln -sf "/tmp/resolv.conf.auto" /tmp/resolv.conf | ||||||
|  |  | ||||||
| 	rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp | 	rm -f ${BASEDHCPSTAMPFILE}.${cfg}.*.dhcp | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Yousong Zhou
					Yousong Zhou