From toor@van-laarhoven.org  Tue Jun  6 05:25:41 2006
Return-Path: <toor@van-laarhoven.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9B34316A5C0
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  6 Jun 2006 05:06:37 +0000 (UTC)
	(envelope-from toor@van-laarhoven.org)
Received: from smtp04.wanadoo.nl (smtp04.wanadoo.nl [194.134.35.144])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2BF7C43D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  6 Jun 2006 05:06:37 +0000 (GMT)
	(envelope-from toor@van-laarhoven.org)
Received: from uitsmijter.van-laarhoven.org (ap-zvhz-13f05.adsl.wanadoo.nl [81.69.93.5])
	by smtp4.wanadoo.nl (Postfix) with ESMTP id 7E940425CF
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  6 Jun 2006 07:06:35 +0200 (CEST)
Received: (qmail 31073 invoked from network); 6 Jun 2006 05:06:35 -0000
Received: from 10.66.0.141 by uitsmijter.van-laarhoven.org (envelope-from <toor@van-laarhoven.org>, uid 82) with qmail-scanner-1.25 
 (clamdscan: 0.88.2/1459. f-prot: 4.6.6/3.16.14. spamassassin: 3.1.1.  
 Clear:RC:1(10.66.0.141):. 
 Processed in 0.049422 secs); 06 Jun 2006 05:06:35 -0000
Received: from unknown (HELO van-laarhoven.org) (nick@10.66.0.141)
  by uitsmijter.van-laarhoven.org with SMTP; 6 Jun 2006 05:06:35 -0000
Received: (nullmailer pid 1145 invoked by uid 0);
	Tue, 06 Jun 2006 05:06:35 -0000
Message-Id: <1149570395.056129.1144.nullmailer@van-laarhoven.org>
Date: Tue, 06 Jun 2006 07:06:35 +0200
From: Nick Hibma <n_hibma@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: the link check by dhclient slows down booting on a laptop
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         98577
>Category:       bin
>Synopsis:       [patch] dhclient(8): the link check by dhclient slows down booting on a laptop
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 06 05:30:17 GMT 2006
>Closed-Date:    
>Last-Modified:  Wed Oct 29 18:18:54 UTC 2008
>Originator:     Nick Hibma
>Release:        FreeBSD 6.1-RC i386
>Organization:
>Environment:
System: FreeBSD hind.van-laarhoven.org 6.1-RC FreeBSD 6.1-RC #15: Tue May 30 12:01:11 CEST 2006 root@hind.van-laarhoven.org:/usr/src/sys/i386/compile/HIND i386

>Description:

Dhclient is nowadays waiting for the link to come up before continuing. That
makes the -b (become a daemon immediately) less useful. Ctrl-C at that point
makes the whole rc.d script fail.

>How-To-Repeat:

Set
	background_dhclient="YES"
in rc.conf, remove ethernet plug (I assume that it is a rl0 iface) and run
	/etc/rc.d/netif restart rl0
Notice the long wait.

>Fix:

Move the checking for link (/usr/src/sbin/dhclient/dhclient.c) after the first
go_daemon case. Problems might be chroot and fork_privchild. Untested.
>Release-Note:
>Audit-Trail:

From: jannisan@t-online.de (Jan Rochel)
To: bug-followup@FreeBSD.org, n_hibma@freebsd.org
Cc:  
Subject: Re: bin/98577: dhclient(8): the link check by dhclient slows down booting on a laptop
Date: Fri, 25 May 2007 14:27:28 +0200

 Currently, the "no link"-timeout is wired-in (10 seconds) in line 364.
 It's probably the best solution to add a linkdown-timeout-option to
 dhclient.conf where the timeout can be set (as all the other timeouts).
State-Changed-From-To: open->suspended 
State-Changed-By: linimon 
State-Changed-When: Mon Jan 28 09:16:03 UTC 2008 
State-Changed-Why:  
Mark suspended awaiting patches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=98577 

From: Nick Hibma <nick@anywi.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/98577: [request] dhclient(8): the link check by dhclient slows down booting on a laptop
Date: Wed, 29 Oct 2008 19:00:46 +0100

 I actually did a patch quite some time ago. Below a block of code is simply 
 moved from one spot to another.
 
 Index: dhclient.c
 ===================================================================
 --- dhclient.c	(revision 184060)
 +++ dhclient.c	(working copy)
 @@ -371,22 +371,6 @@
  
  	read_client_conf();
  
 -	if (!interface_link_status(ifi->name)) {
 -		fprintf(stderr, "%s: no link ...", ifi->name);
 -		fflush(stderr);
 -		sleep(1);
 -		while (!interface_link_status(ifi->name)) {
 -			fprintf(stderr, ".");
 -			fflush(stderr);
 -			if (++i > 10) {
 -				fprintf(stderr, " giving up\n");
 -				exit(1);
 -			}
 -			sleep(1);
 -		}
 -		fprintf(stderr, " got link\n");
 -	}
 -
  	if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
  		error("cannot open %s: %m", _PATH_DEVNULL);
  
 @@ -438,6 +422,22 @@
  	if (immediate_daemon)
  		go_daemon();
  
 +	if (!interface_link_status(ifi->name)) {
 +		fprintf(stderr, "%s: no link ...", ifi->name);
 +		fflush(stderr);
 +		sleep(1);
 +		while (!interface_link_status(ifi->name)) {
 +			fprintf(stderr, ".");
 +			fflush(stderr);
 +			if (++i > 10) {
 +				fprintf(stderr, " giving up\n");
 +				exit(1);
 +			}
 +			sleep(1);
 +		}
 +		fprintf(stderr, " got link\n");
 +	}
 +
  	ifi->client->state = S_INIT;
  	state_reboot(ifi);
  
State-Changed-From-To: suspended->open 
State-Changed-By: linimon 
State-Changed-When: Wed Oct 29 18:18:19 UTC 2008 
State-Changed-Why:  
Patch received. 

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