Bug 1032809 - dhclient-script: set address lifetimes
dhclient-script: set address lifetimes
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: dhcp (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Jiri Popelka
Release Test Team
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-20 16:53 EST by Dan Williams
Modified: 2014-06-17 20:38 EDT (History)
7 users (show)

See Also:
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 07:10:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Assign lease time to addresses added by dhclient-script (2.83 KB, patch)
2013-11-20 16:53 EST, Dan Williams
no flags Details | Diff
Assign lease time to addresses added by dhclient-script (1.81 KB, patch)
2013-11-21 08:43 EST, Jiri Popelka
no flags Details | Diff

  None (edit)
Description Dan Williams 2013-11-20 16:53:42 EST
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 17:41:25 EST
+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 08:43:53 EST
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 10:52:57 EST
(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 12:52:22 EST
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 06:24:38 EST
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 04:23:32 EST
Verified on dhclient-4.2.5-26.el7, kernel address's lifetime is properly set.
Comment 13 Ludek Smid 2014-06-13 07:10:16 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.