Bug 1058519

Summary: Should set address lifetimes in dhclient-script.sh
Product: Red Hat Enterprise Linux 7 Reporter: Dan Williams <dcbw>
Component: dracutAssignee: dracut-maint
Status: CLOSED CURRENTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: dracut-maint-list, harald, jstodola, ljozsa, pbonzini
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:38:47 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:
Bug Depends On:    
Bug Blocks: 1050914    

Description Dan Williams 2014-01-28 00:41:12 UTC
Similar to bug 1032809 (for dhclient) the dracut dhclient-script.sh should set address lifetimes to the DHCP lease time, so that other stuff (like NetworkManager!) knows that the address is temporary and was created by DHCP.  

This should be as simple as something like this (untested):

diff -up dracut-034/modules.d/40network/dhclient-script.sh.foo dracut-034/modules.d/40network/dhclient-script.sh
--- dracut-034/modules.d/40network/dhclient-script.sh.foo	2014-01-27 18:36:33.965704565 -0600
+++ dracut-034/modules.d/40network/dhclient-script.sh	2014-01-27 18:40:04.528072174 -0600
@@ -12,6 +12,7 @@ setup_interface() {
     search=$(printf -- "$new_domain_search")
     namesrv=$new_domain_name_servers
     hostname=$new_host_name
+    lease_time=$new_dhcp_lease_time
 
     [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
 
@@ -29,7 +30,9 @@ setup_interface() {
         fi
     fi
 
-    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif
+    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
+        valid_lft ${lease_time} preferred_lft ${lease_time} \
+        dev $netif
 
     [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
 

and will result in 'ip addr' showing the correct valid_lft and preferred_lft instead of "forever", which they clearly are not valid for.

Thanks!

Comment 3 Ladislav Jozsa 2014-02-21 13:42:47 UTC
Verified with dracut-033-124.el7, RHEL-7.0-20140220.2. Kernel lifetimes are correctly set in dracut environment.

Comment 4 Ludek Smid 2014-06-13 11:38:47 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.