changeset 5433:f41e780ef9c2 draft

DHCP: Adjust prior to be more generic
author Roy Marples <roy@marples.name>
date Tue, 01 Sep 2020 12:15:00 +0100
parents d7cc41338b01
children dead0d841402
files src/ipv4.c
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/ipv4.c	Tue Sep 01 11:56:53 2020 +0100
+++ b/src/ipv4.c	Tue Sep 01 12:15:00 2020 +0100
@@ -629,6 +629,11 @@
 	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;
@@ -711,18 +716,9 @@
 {
 	struct dhcp_state *state;
 	struct ipv4_addr *ia;
-	uint32_t vltime, pltime;
-
-	if (ifp->options->options & DHCPCD_LASTLEASE_EXTEND) {
-		/* We don't want the kernel to expire the address. */
-		vltime = pltime = DHCP_INFINITE_LIFETIME;
-	} else {
-		vltime = lease->leasetime;
-		pltime = lease->rebindtime;
-	}
 
 	ia = ipv4_addaddr(ifp, &lease->addr, &lease->mask, &lease->brd,
-	    vltime, pltime);
+	    lease->leasetime, lease->rebindtime);
 	if (ia == NULL)
 		return -1;