changeset 5434:dead0d841402 draft

DHCP: optimize prior for systems without IPv4 address lifetimes
author Roy Marples <roy@marples.name>
date Tue, 01 Sep 2020 12:24:42 +0100
parents f41e780ef9c2
children 557a3f9f2be4
files src/ipv4.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv4.c	Tue Sep 01 12:15:00 2020 +0100
+++ b/src/ipv4.c	Tue Sep 01 12:24:42 2020 +0100
@@ -629,11 +629,6 @@
 	struct ipv4_addr *replaced_ia;
 #endif
 
-	if (ifp->options->options & DHCPCD_LASTLEASE_EXTEND) {
-		/* We don't want the kernel to expire the address. */
-		vltime = pltime = DHCP_INFINITE_LIFETIME;
-	}
-
 	if ((state = ipv4_getstate(ifp)) == NULL) {
 		logerr(__func__);
 		return NULL;
@@ -666,8 +661,13 @@
 	ia->mask = *mask;
 	ia->brd = *bcast;
 #ifdef IP_LIFETIME
-	ia->vltime = vltime;
-	ia->pltime = pltime;
+	if (ifp->options->options & DHCPCD_LASTLEASE_EXTEND) {
+		/* We don't want the kernel to expire the address. */
+		ia->vltime = ia->pltime = DHCP_INFINITE_LIFETIME;
+	} else {
+		ia->vltime = vltime;
+		ia->pltime = pltime;
+	}
 #else
 	UNUSED(vltime);
 	UNUSED(pltime);