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