changeset 2866:63f1b883f753 draft

If a DHCP lease has expired on reboot, don't expire it right away as that might violate POLA. It will either be removed or renewed depending on the DHCP server regardless.
author Roy Marples <roy@marples.name>
date Wed, 26 Nov 2014 12:08:32 +0000
parents 652f422eebba
children ef1f581001c6
files dhcp.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp.c	Wed Nov 26 11:35:38 2014 +0000
+++ b/dhcp.c	Wed Nov 26 12:08:32 2014 +0000
@@ -3166,8 +3166,22 @@
 				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;