]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network/dhclient-script.sh: set lease time
authorHarald Hoyer <harald@redhat.com>
Tue, 28 Jan 2014 11:12:43 +0000 (12:12 +0100)
committerHarald Hoyer <harald@redhat.com>
Tue, 29 Jul 2014 09:52:05 +0000 (11:52 +0200)
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

index 07c3d9bec6e70075873b7db01a245644c0afe97c..70a2b71084aaa8bea5d32c8ebf42811516aa457a 100755 (executable)
@@ -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