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
master
Harald Hoyer 2014-01-28 12:12:43 +01:00
parent 93f44f28a2
commit 247d6d4270
1 changed files with 4 additions and 1 deletions

View File

@ -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