Re: dhclient/dhclient.conf change in -CURRENT?

From: Martin Blapp <mb_at_imp.ch>
Date: Tue, 5 Aug 2003 00:02:47 +0200 (CEST)
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
_at__at_ -782,6 +782,7 _at__at_
 	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
_at__at_ -413,6 +413,11 _at__at_
 			     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)
_at__at_ -1385,9 +1390,6 _at__at_
 	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;

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

+	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
_at__at_ -3222,6 +3227,13 _at__at_
 				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
------------------------------------------------------------------
Received on Mon Aug 04 2003 - 13:02:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:17 UTC