Blame SOURCES/0253-network-dhclient-script.sh-make-IPv4-DHCP-lease-time.patch

64b87c
From 4ec362ce0ba3fc8b10df83c015d88e002f8ccd36 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Wed, 1 Jul 2015 14:57:15 +0200
64b87c
Subject: [PATCH] network/dhclient-script.sh: make IPv4 DHCP lease time
64b87c
 optionally
64b87c
64b87c
If bootp is used, no lease time is provided in the packet from the bootp
64b87c
server.
64b87c
64b87c
(cherry picked from commit 0f89ec314b062a410199251db0356a55b4773173)
64b87c
---
64b87c
 modules.d/40network/dhclient-script.sh | 12 ++++++++----
64b87c
 1 file changed, 8 insertions(+), 4 deletions(-)
64b87c
64b87c
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
1755ca
index d96f7d94..7972af99 100755
64b87c
--- a/modules.d/40network/dhclient-script.sh
64b87c
+++ b/modules.d/40network/dhclient-script.sh
64b87c
@@ -23,7 +23,11 @@ setup_interface() {
64b87c
     search=$(printf -- "$new_domain_search")
64b87c
     namesrv=$new_domain_name_servers
64b87c
     hostname=$new_host_name
64b87c
-    lease_time=$new_dhcp_lease_time
64b87c
+
64b87c
+    [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
64b87c
+    [ -n "$new_max_life" ] && lease_time=$new_max_life
64b87c
+    preferred_lft=$lease_time
64b87c
+    [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
64b87c
 
64b87c
     [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
64b87c
 
64b87c
@@ -41,9 +45,9 @@ setup_interface() {
64b87c
         fi
64b87c
     fi
64b87c
 
64b87c
-    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
64b87c
-        valid_lft ${lease_time} preferred_lft ${lease_time} \
64b87c
-        dev $netif
64b87c
+    ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif \
64b87c
+        ${lease_time:+valid_lft $lease_time} \
64b87c
+        ${preferred_lft:+preferred_lft ${preferred_lft}}
64b87c
 
64b87c
     [ -n "$gw" ] && echo ip route replace default via $gw dev $netif > /tmp/net.$netif.gw
64b87c