svn commit: r239564 - head/sbin/dhclient

John Baldwin jhb at freebsd.org
Wed Aug 22 20:06:34 UTC 2012


On Wednesday, August 22, 2012 11:24:05 am Jan Beich wrote:
> (mx1.freebsd.org hates my smtp relay)
> 
> John Baldwin <jhb at 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 at 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


More information about the svn-src-all mailing list