]> 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, 28 Jan 2014 11:12:43 +0000 (12:12 +0100)
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 af483acb9a6585b77dc9cfccc4a0c12c2e255c9b..b8d770b7f4555a9e9eff58e2d39b26a844517c8e 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