# HG changeset patch # User Roy Marples # Date 1598958900 -3600 # Node ID f41e780ef9c29c0b00b19f965312c9733b3f1947 # Parent d7cc41338b017ce61e49d5de7ca366098f9ba389 DHCP: Adjust prior to be more generic diff -r d7cc41338b01 -r f41e780ef9c2 src/ipv4.c --- 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;