dhclient: "no expiry time on offered lease" with null address lease time

Karl Beldan karl.beldan at gmail.com
Wed Aug 25 20:17:20 UTC 2010


diff -Narup a/client/dhclient.c b/client/dhclient.c
--- a/client/dhclient.c	2010-08-24 00:00:00.000000000 +0200
+++ b/client/dhclient.c	2010-08-24 00:00:00.000000000 +0200
@@ -991,6 +991,7 @@ void dhcpack (packet)
 	struct client_lease *lease;
 	struct option_cache *oc;
 	struct data_string ds;
+	TIME   expiry;

 	/* If we're not receptive to an offer right now, or if the offer
 	   has an unrecognizable transaction id, then just drop it. */
@@ -1036,17 +1037,19 @@ void dhcpack (packet)
 	oc = lookup_option (&dhcp_universe, client -> new -> options,
 			    DHO_DHCP_LEASE_TIME);
 	memset (&ds, 0, sizeof ds);
+	expiry = 0;
 	if (oc &&
 	    evaluate_option_cache (&ds, packet, (struct lease *)0, client,
 				   packet -> options, client -> new -> options,
 				   &global_scope, oc, MDL)) {
-		if (ds.len > 3)
-			client -> new -> expiry = getULong (ds.data);
-		else
-			client -> new -> expiry = 0;
+		if (ds.len > 3) {
+			expiry = getULong (ds.data);
+			if (expiry == 0)
+				expiry = TIME_MAX;
+		}
 		data_string_forget (&ds, MDL);
-	} else
-			client -> new -> expiry = 0;
+	}
+	client -> new -> expiry = expiry;

 	if (!client -> new -> expiry) {
 		log_error ("no expiry time on offered lease.");
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dhclient-null-lease-time.patch
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20100825/19bafc27/attachment.ksh>


More information about the dhcp-users mailing list