Blame SOURCES/0281-Add-support-for-ethernet-point-to-point-connections-.patch

712866
From 28be8992c3c1facfd80dfcc6afad951f33098783 Mon Sep 17 00:00:00 2001
712866
From: Gerd von Egidy <gerd.von.egidy@intra2net.com>
712866
Date: Thu, 5 Mar 2015 12:07:57 +0100
712866
Subject: [PATCH] Add support for ethernet point-to-point connections
712866
 configured via DHCP
712866
712866
When current dracut receives an ip with netmask of 255.255.255.255 via DHCP,
712866
setting the also supplied default gateway fails (because it is obviously not
712866
within the netmask).
712866
712866
The setup with a netmask of /32 is quite common in colocation datacenters
712866
where you don't want the machines of two different customers to directly talk
712866
to each other. At least two of the biggest colocation providers in Germany
712866
(1&1 and Strato) do it that way. NetworkManager supports this kind of setup
712866
and the dhclient-scripts of several distributions too.
712866
712866
In this patch I have implemented a simple approach very similar to what is
712866
found in Debian. The dhclient-script from Fedora uses a more sophisticated
712866
approach, but that relies on the ipcalc utility which would introduce a
712866
dependency on Fedora-initscripts for dracut.
712866
712866
Signed-off-by: Gerd von Egidy <gerd.von.egidy@intra2net.com>
712866
(cherry picked from commit 99ccbc30dff9fa51dd3187dc10f8f632e5e54e4b)
712866
---
712866
 modules.d/40network/dhclient-script.sh | 8 +++++++-
712866
 1 file changed, 7 insertions(+), 1 deletion(-)
712866
712866
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
5c6c2a
index 7972af99..12e2869f 100755
712866
--- a/modules.d/40network/dhclient-script.sh
712866
+++ b/modules.d/40network/dhclient-script.sh
712866
@@ -49,7 +49,13 @@ setup_interface() {
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
+    if [ -n "$gw" ] ; then
712866
+        if [ "$mask" == "255.255.255.255" ] ; then
712866
+            # point-to-point connection => set explicit route to gateway
712866
+            echo ip route add $gw dev $netif > /tmp/net.$netif.gw
712866
+        fi
712866
+        echo ip route replace default via $gw dev $netif >> /tmp/net.$netif.gw
712866
+    fi
712866
 
712866
     [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
712866
     if  [ -n "$namesrv" ] ; then