Bug 1032809

Summary: dhclient-script: set address lifetimes
Product: Red Hat Enterprise Linux 7 Reporter: Dan Williams <dcbw>
Component: dhcpAssignee: Jiri Popelka <jpopelka>
Status: CLOSED CURRENTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: hannsj_uhl, hartsjc, jpopelka, ljozsa, ovasik, psimerda, vyasevic
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dhcp-4.2.5-26.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:10:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Assign lease time to addresses added by dhclient-script
none
Assign lease time to addresses added by dhclient-script none

Description Dan Williams 2013-11-20 21:53:42 UTC
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.

Comment 2 Pavel Šimerda (pavlix) 2013-11-20 22:41:25 UTC
+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?

Comment 3 Jiri Popelka 2013-11-21 13:43:53 UTC
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.

Comment 4 Dan Williams 2013-11-21 15:52:57 UTC
(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.

Comment 7 Vlad Yasevich 2014-01-10 17:52:22 UTC
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

Comment 8 Jiri Popelka 2014-01-13 11:24:38 UTC
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.

Comment 12 Ladislav Jozsa 2014-02-11 09:23:32 UTC
Verified on dhclient-4.2.5-26.el7, kernel address's lifetime is properly set.

Comment 13 Ludek Smid 2014-06-13 11:10:16 UTC
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.