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

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