Hide Forgot
Created attachment 826866 [details] Assign lease time to addresses added by dhclient-script dhclient-script should utilize the new 'lifetime' options of iproute2 3.11+ to set the lifetimes of any addresse it adds to the duration of the lease time. This is correct (the address should not live longer than the lease, especially if dhclient crashes) and also allows other programs (like NetworkManager) to know that the address is not a statically configured address. See also https://bugzilla.redhat.com/show_bug.cgi?id=1031763#c15 in which NM cannot recognize that the address was added by dhclient. It might be as easy as using "new_dhcp_lease_time" as the argument for valid & preferred times for /sbin/ip when adding addresses, since both are in seconds. The attached patch seems to do the trick for me, though of course more testing is required.
+1 We came up with this idea October 2012 in Westford and it was nice to see this happening in kernel, iproute2 and NetworkManager already. Just a sidenote for Dan, before I changed the team, I also kept route lifetimes on my personal TODO list. That would allow you to distinguish static routes from dynamic ones, even for default route where it might be especially useful. Maybe we could prepare dhclient for that as well?
Created attachment 827184 [details] Assign lease time to addresses added by dhclient-script (In reply to Dan Williams from comment #0) > It might be as easy as using "new_dhcp_lease_time" as the argument for valid > & preferred times for /sbin/ip when adding addresses, since both are in > seconds. The attached patch seems to do the trick for me, though of course > more testing is required. Yes, that looks good - for 'dhclient -4'. For 'dhclient -6' it's even easier because there are 2 values: new_max_life & new_preferred_life which have the same meaning as /sbin/ip's valid_lft & preferred_lft.
(In reply to Pavel Šimerda from comment #2) > +1 > > We came up with this idea October 2012 in Westford and it was nice to see > this happening in kernel, iproute2 and NetworkManager already. Just a > sidenote for Dan, before I changed the team, I also kept route lifetimes on > my personal TODO list. That would allow you to distinguish static routes > from dynamic ones, even for default route where it might be especially > useful. Maybe we could prepare dhclient for that as well? Yeah, that would be useful too. Though when looking into this yesterday, I didn't find any iproute2 options for route lifetimes, so I guess this would have to wait for iproute2.
Hi Jiri I've traced the cause of Bug 1046405 and Bug 1046517 to this change. The problem displays itself as address going away from the interface while the interface is running. Tracing the kernel shows the address is timed out by the kernel because its lifetime has expired. Looking the script, the lifetime is only updated when REBIND happens, but that's not a normal operation. In normal circumstances, we have a RENEW operation on which the lifetime is not updated. In the end, the even though the lease has been extended via RENEW, the kernel address lifetimes have not changed since the original and the address is cleaned-up. This is really noticeable when the leases are short, but I don't have the infrastructure to test. Can you please take a look. Thanks -vlad
Thank you for the investigation Vlad, you are right. We set the lifetimes when we add the address, but don't touch it later during RENEW - this needs to be changed.
Verified on dhclient-4.2.5-26.el7, kernel address's lifetime is properly set.
This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request.