From amdmi3@amdmi3.ru  Sat Apr 25 02:45:25 2009
Return-Path: <amdmi3@amdmi3.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 18B8A1065670
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 25 Apr 2009 02:45:25 +0000 (UTC)
	(envelope-from amdmi3@amdmi3.ru)
Received: from smtp.timeweb.ru (smtp.timeweb.ru [217.170.79.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 98A938FC19
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 25 Apr 2009 02:45:24 +0000 (UTC)
	(envelope-from amdmi3@amdmi3.ru)
Received: from [213.148.20.85] (helo=hive.panopticon)
	by smtp.timeweb.ru with esmtpsa (TLSv1:AES256-SHA:256)
	(Exim 4.69)
	(envelope-from <amdmi3@amdmi3.ru>)
	id 1LxXtM-0003ip-C8
	for FreeBSD-gnats-submit@freebsd.org; Sat, 25 Apr 2009 06:45:24 +0400
Received: from hades.panopticon (hades.panopticon [192.168.0.32])
	by hive.panopticon (Postfix) with ESMTP id 37B486C48
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 25 Apr 2009 06:45:57 +0400 (MSD)
Received: by hades.panopticon (Postfix, from userid 1000)
	id 0EE10108841; Sat, 25 Apr 2009 06:44:43 +0400 (MSD)
Message-Id: <20090425024443.0EE10108841@hades.panopticon>
Date: Sat, 25 Apr 2009 06:44:43 +0400 (MSD)
From: Dmitry Marakasov <amdmi3@FreeBSD.org>
Reply-To: Dmitry Marakasov <amdmi3@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [rc.d] defaultroute broken with DHCP in some cases
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         133987
>Category:       conf
>Synopsis:       [rc.d] defaultroute broken with DHCP in some cases
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 25 02:50:02 UTC 2009
>Closed-Date:    Thu Jul 07 07:36:13 UTC 2011
>Last-Modified:  Thu Jul 07 07:36:13 UTC 2011
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sat Apr 25 04:57:52 MSD 2009 root@hades.panopticon:/async/obj/usr/src/sys/HADES i386


>Description:
There's problem when using DHCP at least with ale(4) interface: unless using synchronous_dhclient="YES", interface won't get IP address at all on boot -> the box will end up without default route and with most of network services failing to start.

The cause of this is the check at the start of defaultroute_start (/etc/rc.d/defaultroute): it will only wait for default route if there's DHCP-configured interface with carrier. ale, however, usually happens to be DOWN by the time defaultroute is executed -> no wait for default route -> broken boot.

Here's the boot log for the case when synchronous_dhclient="YES" is used. Note interface being DOWN by the time rc is executed, and going UP couple of seconds after.

---
ale0: <Atheros AR8121/AR8113/AR8114 PCIe Ethernet> port 0xdc00-0xdc7f mem 0xfe9c0000-0xfe9fffff irq 17 at device 0.0 on pci2
ale0: 960 Tx FIFO, 1024 Rx FIFO
ale0: Using 1 MSI messages.
miibus0: <MII bus> on ale0
atphy0: <Atheros F1 10/100/1000 PHY> PHY 0 on miibus0
atphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, auto
ale0: Ethernet address: 00:22:15:75:15:b2
ale0: [FILTER]
... (many other devices)
ale0: changing name to 'panopticon'
panopticon: link state changed to DOWN
panopticon: no link .....panopticon: link state changed to UP
 got link
DHCPREQUEST on panopticon to 255.255.255.255 port 67
DHCPREQUEST on panopticon to 255.255.255.255 port 67
DHCPACK from 192.168.0.2
bound to 192.168.0.32 -- renewal in 43200 seconds.
---

>How-To-Repeat:
Boot with single ale(4) interface configured with DHCP.
>Fix:
The solution is probably to remove check for carrier in defaultroute_start() at all. That'll lead to extra 30 second wait for the people booting with no net access at all, but will ensure correct boot for others.
brooks@ has even better idea: http://www.mail-archive.com/svn-src-all@freebsd.org/msg08127.html
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sat Apr 25 11:34:00 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133987 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Thu Jul 7 07:35:33 UTC 2011 
State-Changed-Why:  

synchronous dhcp solves your problem, as you described. 


Responsible-Changed-From-To: freebsd-rc->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Thu Jul 7 07:35:33 UTC 2011 
Responsible-Changed-Why:  

I closed it 

http://www.freebsd.org/cgi/query-pr.cgi?pr=133987 
>Unformatted:
