From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 1 21:50:03 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67D8F1065670 for ; Mon, 1 Mar 2010 21:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 29A918FC16 for ; Mon, 1 Mar 2010 21:50:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id o21Lo3Qp069906 for ; Mon, 1 Mar 2010 21:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id o21Lo3Iu069905; Mon, 1 Mar 2010 21:50:03 GMT (envelope-from gnats) Resent-Date: Mon, 1 Mar 2010 21:50:03 GMT Resent-Message-Id: <201003012150.o21Lo3Iu069905@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, andy wilson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D523106564A for ; Mon, 1 Mar 2010 21:41:28 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 6C0F68FC0C for ; Mon, 1 Mar 2010 21:41:28 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o21LfS22016380 for ; Mon, 1 Mar 2010 21:41:28 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o21LfSKU016379; Mon, 1 Mar 2010 21:41:28 GMT (envelope-from nobody) Message-Id: <201003012141.o21LfSKU016379@www.freebsd.org> Date: Mon, 1 Mar 2010 21:41:28 GMT From: andy wilson To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/144400: [patch] /etc/rc.d/named - $named_wait_host needs an upper bound X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2010 21:50:03 -0000 >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 jepp@urania.tx.net:/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: