Blame SOURCES/dhcp-4.2.5-expiry_before_renewal_v2.patch

45d60a
diff -up dhcp-4.2.5/client/dhclient.c.orig dhcp-4.2.5/client/dhclient.c
45d60a
--- dhcp-4.2.5/client/dhclient.c.orig	2018-11-07 14:21:16.756152614 +0100
45d60a
+++ dhcp-4.2.5/client/dhclient.c	2018-11-08 17:30:15.754440523 +0100
45d60a
@@ -1618,8 +1618,14 @@ void dhcpack (packet)
45d60a
 	} else
45d60a
 			client -> new -> renewal = 0;
45d60a
 
45d60a
-	/* If it wasn't specified by the server, calculate it. */
45d60a
-	if (!client -> new -> renewal)
45d60a
+	/* 
45d60a
+	 * If it wasn't specified by the server, calculate it. Also use expiry
45d60a
+	 * instead of renewal time when it is shorter. This better follows 
45d60a
+	 * RFC 2131 (section 4.4.5) when dealing with some DHCP servers.
45d60a
+	 */
45d60a
+	
45d60a
+	if (!client -> new -> renewal ||
45d60a
+	    client -> new -> renewal > client -> new -> expiry)
45d60a
 		client -> new -> renewal = client -> new -> expiry / 2 + 1;
45d60a
 
45d60a
 	if (client -> new -> renewal <= 0)
45d60a
@@ -1645,7 +1651,9 @@ void dhcpack (packet)
45d60a
 	} else
45d60a
 			client -> new -> rebind = 0;
45d60a
 
45d60a
-	if (client -> new -> rebind <= 0) {
45d60a
+	/* Rebinding time must not be longer than expiry. */
45d60a
+	if (client -> new -> rebind <= 0 ||
45d60a
+	    client -> new -> rebind > client -> new -> expiry) {
45d60a
 		if (client -> new -> expiry <= TIME_MAX / 7)
45d60a
 			client -> new -> rebind =
45d60a
 					client -> new -> expiry * 7 / 8;