From: Roy Marples Date: Tue, 1 Sep 2020 11:15:00 +0000 (+0100) Subject: DHCP: Adjust prior to be more generic X-Git-Tag: v9.2.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d40e9fc32ccdfe02668250d4360cd3f47c61796d;p=thirdparty%2Fdhcpcd.git DHCP: Adjust prior to be more generic --- diff --git a/src/ipv4.c b/src/ipv4.c index 0590eb0d..e460630c 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -629,6 +629,11 @@ ipv4_addaddr(struct interface *ifp, const struct in_addr *addr, 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 @@ ipv4_daddaddr(struct interface *ifp, const struct dhcp_lease *lease) { 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;