Having trouble starting named from dns/bind99 automatically? Here’s how I solved it!

I tried to convince named from dns/bind99, as of r333563, to start automatically at (re)boot on stable/10 and head.

My /etc/rc.conf file contains lines like these:

named_enable="YES"
named_program="/usr/local/sbin/named"
named_wait="YES"
named_wait_host="localhost"
named_auto_forward="YES"
named_auto_forward_only="YES"

Eventually, I resolved the matter using the following patch:

--- named.orig  2013-11-18 15:51:27.339844000 +0100
+++ named       2013-11-18 15:53:35.587723548 +0100
@@ -19,15 +19,15 @@
 reload_cmd="named_reload"
 stop_cmd="named_stop"

-named_enable="NO"              # Run named, the DNS server (or NO).
-named_program="/usr/local/sbin/named"  # Path to named, if you want a different one.
-named_conf="/usr/local/etc/namedb/named.conf"  # Path to the configuration file
+named_enable=${named_enable-"NO"}              # Run named, the DNS server (or NO).
+named_program=${named_program-"/usr/local/sbin/named"} # Path to named, if you want a different one.
+named_conf=${named_conf-"/usr/local/etc/namedb/named.conf"}    # Path to the configuration file
 #named_flags=""                        # Use this for flags OTHER than -u and -c
-named_uid="bind"               # User to run named as
-named_wait="NO"                        # Wait for working name service before exiting
-named_wait_host="localhost"    # Hostname to check if named_wait is enabled
-named_auto_forward="NO"                # Set up forwarders from /etc/resolv.conf
-named_auto_forward_only="NO"   # Do "forward only" instead of "forward first"
+named_uid=${named_uid-"bind"}          # User to run named as
+named_wait=${named_wait-"NO"}                  # Wait for working name service before exiting
+named_wait_host=${named_wait_host-"localhost"} # Hostname to check if named_wait is enabled
+named_auto_forward=${named_auto_forward-"NO"}          # Set up forwarders from /etc/resolv.conf
+named_auto_forward_only=${named_auto_forward_only-"NO"}        # Do "forward only" instead of "forward first"

 named_poststart() {
        if checkyesno named_wait; then

The tabs are missing, so you better apply this patch by hand. It’s not that difficult.

I have emailed the patch to the maintainer of dns/bind99, and I hope the patch hits the Subversion repos within a day or two.