]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
If a DHCP lease has expired on reboot, don't expire it right away as that
authorRoy Marples <roy@marples.name>
Wed, 26 Nov 2014 12:08:32 +0000 (12:08 +0000)
committerRoy Marples <roy@marples.name>
Wed, 26 Nov 2014 12:08:32 +0000 (12:08 +0000)
might violate POLA. It will either be removed or renewed depending on the
DHCP server regardless.

dhcp.c

diff --git a/dhcp.c b/dhcp.c
index 1330d4adeba5a7eaa3979795a678038b0dfcd737..43d4aaeadd2d717819447bfb2ec0371cc4f4ce9c 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -3166,8 +3166,22 @@ dhcp_start1(void *arg)
                                free(state->offer);
                                state->offer = NULL;
                                state->lease.addr.s_addr = 0;
+                               /* Technically we should discard the lease
+                                * as it's expired, just as DHCPv6 addresses
+                                * would be by the kernel.
+                                * However, this may violate POLA so
+                                * we currently leave it be.
+                                * If we get a totally different lease from
+                                * the DHCP server we'll drop it anyway, as
+                                * we will on any other event which would
+                                * trigger a lease drop.
+                                * This should only happen if dhcpcd stops
+                                * running and the lease expires before
+                                * dhcpcd starts again. */
+#if 0
                                if (state->new)
                                        dhcp_drop(ifp, "EXPIRE");
+#endif
                        } else {
                                l = (uint32_t)(now.tv_sec - st.st_mtime);
                                state->lease.leasetime -= l;