>Number:         144400
>Category:       misc
>Synopsis:       [patch] /etc/rc.d/named - $named_wait_host needs an upper bound
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 01 21:50:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     andy wilson
>Release:        8.0-RELEASE-p2
>Organization:
>Environment:
FreeBSD urania.tx.net 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #3: Wed Feb 24 
11:30:46 CST 2010     [email protected]:/usr/obj/usr/src/sys/URANIA  i386
>Description:
If you set $named_wait_host to a remote hostname and something is going wrong 
with the name resolution process for that particular hostname, your system will 
hang indefinitely. Some services (like ntpd) depend on being able to resolve 
remote DNS hostnames, but you would still want the system to come up if it is 
having trouble resolving $named_wait_host.

It would help to have an additional variable that specifies an upper bound for 
how long /etc/rc.d/named spends attempting to resolve $named_wait_host. That 
way $named_wait_host can be set to a remote hostname but your system will not 
be completely dependent on that hostname successfully resolving.



This addition would make it easy to solve problems like the one discussed here: 
 http://forums.freebsd.org/showthread.php?t=9171

>How-To-Repeat:
Set up rc.conf with the following variables:

ntpd_enable="YES"
named_enable="YES"
named_wait="YES"
named_wait_host="someunresolvablehostname.somenonexistentdomain.com"


Then run: 
/etc/rc.d/named restart
>Fix:
I've attached patches for /etc/rc.d/named and /etc/defaults/rc.conf ; these 
patches add and document an optional $named_wait_max variable that sets the 
maximum number of seconds that rc.d/named will wait while trying to resolve 
$named_wait_host.

Patch attached with submission follows:

--- /etc/rc.d/named.orig        2010-03-01 14:25:19.000000000 -0600
+++ /etc/rc.d/named     2010-03-01 14:26:58.000000000 -0600
@@ -98,11 +98,16 @@
 }
 
 named_poststart () {
+        local count
+
        make_symlinks
 
+        count=0
+
        if checkyesno named_wait; then
-               until ${command%/sbin/named}/bin/host $named_wait_host 
>/dev/null 2>&1; do
+               until ${command%/sbin/named}/bin/host $named_wait_host 
>/dev/null 2>&1 || ([ $named_wait_max ] && [ $count -gt $named_wait_max ]) ; do
                        echo "  Waiting for nameserver to resolve 
$named_wait_host"
+                        count=$((${count} + 1))
                        sleep 1
                done
        fi


--- /etc/defaults/rc.conf.orig  2010-03-01 15:07:19.000000000 -0600
+++ /etc/defaults/rc.conf       2010-03-01 15:13:24.000000000 -0600
@@ -259,6 +259,9 @@
 named_symlink_enable="YES"     # Symlink the chrooted pid file
 named_wait="NO"                # Wait for working name service before exiting
 named_wait_host="localhost"    # Hostname to check if named_wait is enabled
+#named_wait_max="60"            # Maximum number of seconds named_wait will 
wait
+                                # while attempting to resolve named_wait_host.
+                                # If not set, it will never stop waiting.
 named_auto_forward="NO"        # Set up forwarders from /etc/resolv.conf
 named_auto_forward_only="NO"   # Do "forward only" instead of "forward first"
 


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to