Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 16:06:22 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Jan Beich <jbeich@tormail.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r239564 - head/sbin/dhclient
Message-ID:  <201208221606.22178.jhb@freebsd.org>
In-Reply-To: <1T4CmR-00012d-OP@internal.tormail.org>
References:  <201208221353.q7MDrbYB039551__4686.74262888289$1345643666$gmane$org@svn.freebsd.org> <1T4CmR-00012d-OP@internal.tormail.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, August 22, 2012 11:24:05 am Jan Beich wrote:
> (mx1.freebsd.org hates my smtp relay)
> 
> John Baldwin <jhb@FreeBSD.org> writes:
> 
> > Author: jhb
> > Date: Wed Aug 22 13:53:37 2012
> > New Revision: 239564
> > URL: http://svn.freebsd.org/changeset/base/239564
> >
> > Log:
> >   Revert r239356 and use an alternate algorithm.
> 
> Doesn't help here. It now goes into an endless cycle trying to renew IP.
> 
>   $ (pciconf -l; dmesg) | fgrep -m2 fxp0
>   fxp0@pci0:5:0:0:        class=0x020000 card=0xb1440e11 chip=0x12298086 
rev=0x08 hdr=0x00
>   fxp0: <Intel 82559 Pro/100 Ethernet> port 0xd000-0xd03f mem 
0xf9100000-0xf9100fff,0xf9000000-0xf90fffff irq 20 at device 0.0 on pci5

Please try this patch relative to what is in HEAD:

Index: dhcpd.h
===================================================================
--- dhcpd.h	(revision 239564)
+++ dhcpd.h	(working copy)
@@ -209,6 +209,7 @@
 	int			 dead;
 	u_int16_t		 index;
 	int			 linkstat;
+	time_t			 linktime;
 };
 
 struct timeout {
Index: dhclient.c
===================================================================
--- dhclient.c	(revision 239564)
+++ dhclient.c	(working copy)
@@ -285,8 +285,14 @@
 			    ifi->linkstat ? "up" : "down",
 			    linkstat ? "up" : "down");
 			ifi->linkstat = linkstat;
-			if (linkstat)
+
+			/*
+			 * XXX: Hardcoded 5 second grace window on
+			 * link flaps.
+			 */
+			if (linkstat && (cur_time - ifi->linktime) >= 5)
 				state_reboot(ifi);
+			ifi->linktime = cur_time;
 		}
 		break;
 	case RTM_IFANNOUNCE:
@@ -441,6 +447,7 @@
 		fprintf(stderr, " got link\n");
 	}
 	ifi->linkstat = 1;
+	ifi->linktime = cur_time;
 
 	if ((nullfd = open(_PATH_DEVNULL, O_RDWR, 0)) == -1)
 		error("cannot open %s: %m", _PATH_DEVNULL);


-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208221606.22178.jhb>