Blame SOURCES/dhcp-4.2.5-expiry_before_renewal_v2.patch

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