From ade113d75b07ba294facbe943b859624fa45efb9 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 28 Jan 2014 12:12:43 +0100
Subject: [PATCH] network/dhclient-script.sh: set lease time
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.
https://bugzilla.redhat.com/show_bug.cgi?id=1058519
---
modules.d/40network/dhclient-script.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index 07c3d9be..70a2b710 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -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