dhclient/dhclient.conf change in -CURRENT?

Martin Blapp mb at imp.ch
Mon Aug 4 15:02:53 PDT 2003


Hi Larry,

This patch should fix the issues. It is not perfect, because
polling here is a bit complicated. Maybe it does the right
thing, but I think dhclient should at least check if one of the
conditions is suddenly right (we are associated, or we really
have link).

So this needs definitly some work, but it should fix your case.
I'll fix the remaining issues tomorrow.

Martin

--- src/contrib/isc-dhcp/includes/dhcpd.h.orig	Mon Aug  4 23:57:06 2003
+++ src/contrib/isc-dhcp/includes/dhcpd.h	Mon Aug  4 23:57:37 2003
@@ -782,6 +782,7 @@
 	char name [IFNAMSIZ];		/* Its name... */
 	int linkstatus;			/* Link status */
 	int ieee802;			/* True if media is ieee802 */
+	int mediaflag;			/* True if dhclient.conf has media settings */
 	int index;			/* Its index. */
 	int rfdesc;			/* Its read file descriptor. */
 	int wfdesc;			/* Its write file descriptor, if
--- src/contrib/isc-dhcp/client/dhclient.c.orig	Mon Jul 28 15:25:04 2003
+++ src/contrib/isc-dhcp/client/dhclient.c	Mon Aug  4 23:56:04 2003
@@ -413,6 +413,11 @@
 			     INTERFACE_REQUESTED))
 				continue;
 			set_ieee802(ip);
+			if (ip -> client -> config -> media != NULL)
+				ip->mediaflag = 1;
+			else
+				ip->mediaflag = 0;
+
 			script_init (ip -> client,
 				     "PREINIT", (struct string_list *)0);
 			if (ip -> client -> alias)
@@ -1385,9 +1390,6 @@
 	int interval;
 	int increase = 1;

-	if (interface_active(client -> interface) == 0)
-		return;
-
 	/* Figure out how long it's been since we started transmitting. */
 	interval = cur_time - client -> first_sending;

@@ -1427,6 +1429,9 @@
 		}
 	}

+	if (interface_active(client -> interface) == 0)
+		return;
+
 	/* If we're supposed to increase the interval, do so.  If it's
 	   currently zero (i.e., we haven't sent any packets yet), set
 	   it to one; otherwise, add to it a random number between
@@ -3222,6 +3227,13 @@
 				return (1);
 		}
 	}
+
+	/*
+	 * If dhclient.conf contains media settings, we cannot
+	 * abort if the interface is not set to active mode.
+	 */
+	if (ip->mediaflag)
+		return (1);

 	return (0);
 #else /* ifdef __FreeBSD__ */

Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------



More information about the freebsd-current mailing list