# HG changeset patch # User Roy Marples # Date 1598959482 -3600 # Node ID dead0d8414020933642f1bbdb45aae83c6c98f28 # Parent f41e780ef9c29c0b00b19f965312c9733b3f1947 DHCP: optimize prior for systems without IPv4 address lifetimes diff -r f41e780ef9c2 -r dead0d841402 src/ipv4.c --- 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);