From owner-freebsd-stable@FreeBSD.ORG Tue Oct 25 09:53:45 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19729106564A for ; Tue, 25 Oct 2011 09:53:45 +0000 (UTC) (envelope-from freebsd@psconsult.nl) Received: from mx1.psconsult.nl (mx1.iaf.psconsult.nl [80.89.238.138]) by mx1.freebsd.org (Postfix) with ESMTP id 8D6928FC0A for ; Tue, 25 Oct 2011 09:53:44 +0000 (UTC) Received: from mx1.psconsult.nl (mx1.iaf.psconsult.nl [80.89.238.138] (may be forged)) by mx1.psconsult.nl (8.14.4/8.14.4) with ESMTP id p9P9KCeR051998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 25 Oct 2011 11:20:17 +0200 (CEST) (envelope-from freebsd@psconsult.nl) Received: (from paul@localhost) by mx1.psconsult.nl (8.14.4/8.14.4/Submit) id p9P9KCCR051997 for freebsd-stable@freebsd.org; Tue, 25 Oct 2011 11:20:12 +0200 (CEST) (envelope-from freebsd@psconsult.nl) X-Authentication-Warning: mx1.psconsult.nl: paul set sender to freebsd@psconsult.nl using -f Date: Tue, 25 Oct 2011 11:20:12 +0200 From: Paul Schenkeveld To: freebsd-stable@freebsd.org Message-ID: <20111025092012.GA41065@psconsult.nl> References: <4EA5EBB5.3090101@quip.cz> <20111024232750.GA74032@icarus.home.lan> <20111025010327.GA75437@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111025010327.GA75437@icarus.home.lan> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: ntpd couldn't resolve host name on system boot X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2011 09:53:45 -0000 On Mon, Oct 24, 2011 at 06:03:27PM -0700, Jeremy Chadwick wrote: > The one shortcoming of netwait is that it doesn't support waiting for > multiple NICs. Some people have dual-homed environments where they > really would like to wait for both, say, em0 and em1, to come up and be > functional before any more scripts are started. I left that as a > project for someone else, but it's something that should be added given > its importance. How would you like to see multiple interfaces implemented: - All interfaces must be up at the same time - Probe interfaces one by one, proceed to the next when an interface up or bail out when any interface stays down until the loop times out Another shortcoming: ipv6 support... The patch below adds ipv6. One caveat, ping6 is used if a word in netwait_ip contains at least a colon so hostnames in netwait_ip are always pinged using ipv4. Paul Schenkeveld --- src/etc/rc.d/netwait.orig 2011-06-22 08:27:32.000000000 +0200 +++ src/etc/rc.d/netwait 2011-10-25 11:09:16.000000000 +0200 @@ -21,7 +21,7 @@ netwait_start() { - local ip rc count output link + local ip rc count output link ping_cmd if [ -z "${netwait_ip}" ]; then err 1 "You must define one or more IP addresses in netwait_ip" @@ -72,7 +72,13 @@ count=1 while [ ${count} -le ${netwait_timeout} ]; do - /sbin/ping -t 1 -c 1 -o ${ip} >/dev/null 2>&1 + case ${ip} in + *:*) + ping_cmd="/sbin/ping6 -c 1 -o";; + *) + ping_cmd="/sbin/ping -t 1 -c 1 -o";; + esac + ${ping_cmd} ${ip} >/dev/null 2>&1 rc=$? if [ $rc -eq 0 ]; then