Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Oct 2018 20:29:05 +0000 (UTC)
From:      =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r339268 - stable/11/usr.sbin/unbound/local-setup
Message-ID:  <201810092029.w99KT5rT002606@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Tue Oct  9 20:29:04 2018
New Revision: 339268
URL: https://svnweb.freebsd.org/changeset/base/339268

Log:
  MFH (r333574): fully support acting as a recursing resolver.
  
  PR:		222902

Modified:
  stable/11/usr.sbin/unbound/local-setup/local-unbound-setup.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/unbound/local-setup/local-unbound-setup.sh
==============================================================================
--- stable/11/usr.sbin/unbound/local-setup/local-unbound-setup.sh	Tue Oct  9 20:16:19 2018	(r339267)
+++ stable/11/usr.sbin/unbound/local-setup/local-unbound-setup.sh	Tue Oct  9 20:29:04 2018	(r339268)
@@ -253,6 +253,18 @@ gen_unbound_conf() {
 }
 
 #
+# Rename a file we are about to replace.
+#
+backup() {
+	local file="$1"
+	if [ -f "${file}" ] ; then
+		local bkfile="${file}.${bkext}"
+		echo "Original ${file} saved as ${bkfile}"
+		mv "${file}" "${bkfile}"
+	fi
+}
+
+#
 # Replace one file with another, making a backup copy of the first,
 # but only if the new file is different from the old.
 #
@@ -263,9 +275,7 @@ replace() {
 		echo "${file} created"
 		mv "${newfile}" "${file}"
 	elif ! cmp -s "${file}" "${newfile}" ; then
-		local oldfile="${file}.${bkext}"
-		echo "original ${file} saved as ${oldfile}"
-		mv "${file}" "${oldfile}"
+		backup "${file}"
 		mv "${newfile}" "${file}"
 	else
 		echo "${file} not modified"
@@ -359,13 +369,20 @@ main() {
 	# from resolv.conf.
 	#
 	forwarders="$@"
-	if [ -z "$forwarders" ] ; then
+	case "${forwarders}" in
+	[Nn][Oo][Nn][Ee])
+		forwarders="none"
+		style=recursing
+		;;
+	"")
 		echo "Extracting forwarders from ${resolv_conf}."
 		forwarders=$(get_nameservers <"${resolv_conf}")
 		style=dynamic
-	else
+		;;
+	*)
 		style=static
-	fi
+		;;
+	esac
 
 	#
 	# Generate forward.conf.
@@ -377,6 +394,9 @@ main() {
 		else
 			echo "unbound will recurse."
 		fi
+	elif [ "${forwarders}" = "none" ] ; then
+		echo "Forwarding disabled, unbound will recurse."
+		backup "${forward_conf}"
 	else
 		local tmp_forward_conf=$(mktemp -u "${forward_conf}.XXXXX")
 		gen_forward_conf ${forwarders} | unexpand >"${tmp_forward_conf}"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810092029.w99KT5rT002606>