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