Blame SOURCES/dhcp-4.2.5-expiry_before_renewal_v2.patch

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