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

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