18971c
From ade113d75b07ba294facbe943b859624fa45efb9 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Tue, 28 Jan 2014 12:12:43 +0100
18971c
Subject: [PATCH] network/dhclient-script.sh: set lease time
18971c
18971c
The dracut dhclient-script.sh should set address lifetimes to the DHCP
18971c
lease time, so that other stuff (like NetworkManager!) knows that the
18971c
address is temporary and was created by DHCP.
18971c
18971c
https://bugzilla.redhat.com/show_bug.cgi?id=1058519
18971c
---
18971c
 modules.d/40network/dhclient-script.sh | 5 ++++-
18971c
 1 file changed, 4 insertions(+), 1 deletion(-)
18971c
18971c
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
18971c
index 07c3d9be..70a2b710 100755
18971c
--- a/modules.d/40network/dhclient-script.sh
18971c
+++ b/modules.d/40network/dhclient-script.sh
18971c
@@ -12,6 +12,7 @@ setup_interface() {
18971c
     search=$(printf -- "$new_domain_search")
18971c
     namesrv=$new_domain_name_servers
18971c
     hostname=$new_host_name
18971c
+    lease_time=$new_dhcp_lease_time
18971c
 
18971c
     [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
18971c
 
18971c
@@ -29,7 +30,9 @@ setup_interface() {
18971c
         fi
18971c
     fi
18971c
 
18971c
-    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif
18971c
+    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
18971c
+        valid_lft ${lease_time} preferred_lft ${lease_time} \
18971c
+        dev $netif
18971c
 
18971c
     [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
18971c