conf/160960: [patch] /etc/rc.d/named

Dmitry Fomin fdn at okbire.ru
Fri Sep 23 23:30:12 UTC 2011


>Number:         160960
>Category:       conf
>Synopsis:       [patch]  /etc/rc.d/named
>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:   Fri Sep 23 23:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Fomin
>Release:        FreeBSD 8.2-RELEASE-p2
>Organization:
OKB IRE, Russia
>Environment:
FreeBSD f1.okbire.ru 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Mon Sep 19 19:44:
44 UTC 2011     fnd at f1.okbire.ru:/usr/obj/usr/src/sys/F1  i386                  
>Description:
If in a random way to commit an error in /var/named/etc/namedb/named.conf,
at which 'named' doesn't start, or to commit an error                     
in named_wait_host="local" (/etc/rc.conf),                                
then /etc/rc.d/named will work infinitely, if named_wait="YES".           
                                                                          
The computer never to boot.                                               
To avoid such situation, I offer a patch.                                 
>How-To-Repeat:
cat /etc/rc.conf        
..                     
named_enable="YES"      
..                     
named_wait="YES"        
named_wait_host="local" 
..                     
                                              
# /etc/rc.d/named start                  
Starting named.                                
        Waiting for nameserver to resolve local
        Waiting for nameserver to resolve local
        Waiting for nameserver to resolve local
        Waiting for nameserver to resolve local
        Waiting for nameserver to resolve local
..
>Fix:


Patch attached with submission follows:

--- /usr/src/etc/rc.d/named	2010-12-21 17:09:25.000000000 +0000
+++ /usr/src/etc/rc.d/named	2011-09-23 22:01:39.000000000 +0000
@@ -100,9 +100,22 @@
 	make_symlinks
 
 	if checkyesno named_wait; then
-		until ${command%/sbin/named}/bin/host $named_wait_host >/dev/null 2>&1; do
-			echo "	Waiting for nameserver to resolve $named_wait_host"
+		if [ ! -n "${named_wait_timeout}" ]; then
+			named_wait_timeout="${named_wait_timeout-10}"
+		fi
+		local timeout="${named_wait_timeout}"
+		until ${command%/sbin/named}/bin/host -W 1 $named_wait_host >/dev/null 2>&1; do
+			if [ $timeout -eq $named_wait_timeout ]; then
+				echo "	Waiting for nameserver to resolve $named_wait_host"
+				echo ""
+			fi
 			sleep 1
+			timeout=$(($timeout - 1))
+			echo -e "\033[A	Remains to wait time - ${timeout} sec."
+			if [ $timeout -le 0 ]; then
+				echo  "	Wait time (${named_wait_timeout} sec.) has effused."
+				break
+			fi
 		done
 	fi
 }

--- /usr/src/etc/defaults/rc.conf	2010-12-21 17:09:25.000000000 +0000
+++ /usr/src/etc/defaults/rc.conf	2011-09-23 18:43:44.000000000 +0000
@@ -279,6 +279,7 @@
 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_timeout="10"		# Timeout in seconds 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"
 


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list