suggested patch to /usr/ports/dns/bind99/files/

Curtis Villamizar curtis at
Sat Apr 11 19:09:19 UTC 2015


You are listed as the maintainer of dns/bind99 so this is addressed to
you.  Sorry to trouble you.

A similar patch can be applied to dns/bind910.  There would be a line
number shift.  I tried it - it works.

The purpose of this patch is to fix two very minor annoyances.

  1.  If named.conf is moved in /etc/rc.conf with a line such as
      named_conf=/etc/namedb/named.conf, then rndc-confgen creates a
      key in the /etc/namedb but /usr/local/etc/rc.d/named restart or
      reload won't use that key file.  The reload will fail, but the
      restart falls back to using kill.

  2.  The second problem is that if a rndc.conf file is used and put
      in /etc/namedb, rndc won't find it.  It is necessary to use an
      rndc.conf file if running named in a jail, where there is no address or if running IPv6 only and in other
      circumstances, such as if it is desirable to reload remotely
      (although an ssh command also solves this).

The change is simply to load up a rndc_flags variable and use it in
the two places where rndc is used.

btw- there seems to be a non-ascii character in the comment on line
188 after the string "but ${named_program}".  I had to replace that
with a space to get this email message to go out.  As a result the
second hunk may have to be applied manually but its a one line change
(one word addition).


--- files/	2015-03-25 16:25:30.000000000 -0400
+++ files/	2015-04-11 15:02:48.556657000 -0400
@@ -62,6 +62,17 @@
+# Needed if named.conf and rndc.key are moved or if rndc.conf is used
+if [ -s $rndc_conf ] ; then
+    rndc_flags=${rndc_flags:-"-c $rndc_conf"}
+elif [ -s $rndc_key ] ; then
+    rndc_flags=${rndc_flags:-"-k $rndc_key"}
+    rndc_flags=${rndc_flags:-""}
 # If running in a chroot cage, ensure that the appropriate files
 # exist inside the cage, as well as helper symlinks into the cage
 # from outside.
@@ -187,7 +198,7 @@
 	# This is a one line function, but ${named_program} is not defined early
 	# enough to be there when the reload_cmd variable is defined up there.
-	${_named_program_root}/sbin/rndc reload
+	${_named_program_root}/sbin/rndc $rndc_flags reload
@@ -213,7 +224,7 @@
 		return 1
 	echo 'Stopping named.'
-	if ${_named_program_root}/sbin/rndc stop 2>/dev/null; then
+	if ${_named_program_root}/sbin/rndc $rndc_flags stop 2>/dev/null; then
 		wait_for_pids ${rc_pid}
 		echo -n 'rndc failed, trying kill: '

More information about the freebsd-ports mailing list