From owner-svn-src-all@freebsd.org Tue Oct 9 20:29:05 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8787010BB47F; Tue, 9 Oct 2018 20:29:05 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C4BF7B2A1; Tue, 9 Oct 2018 20:29:05 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 373CE1718F; Tue, 9 Oct 2018 20:29:05 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w99KT5QD002607; Tue, 9 Oct 2018 20:29:05 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w99KT5rT002606; Tue, 9 Oct 2018 20:29:05 GMT (envelope-from des@FreeBSD.org) Message-Id: <201810092029.w99KT5rT002606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Tue, 9 Oct 2018 20:29:05 +0000 (UTC) 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 X-SVN-Group: stable-11 X-SVN-Commit-Author: des X-SVN-Commit-Paths: stable/11/usr.sbin/unbound/local-setup X-SVN-Commit-Revision: 339268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Oct 2018 20:29:05 -0000 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}"