Blame SOURCES/0315-network-ifup.sh-do_static-error-out-if-IP-is-already.patch

712866
From 32770ca79a1f6828ca9fdf4b6841e6a6d4e4754a Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Wed, 19 Aug 2015 14:00:28 +0200
712866
Subject: [PATCH] network/ifup.sh:do_static(): error out, if IP is already
712866
 assigned
712866
712866
---
712866
 modules.d/40network/ifup.sh | 9 +++++++++
712866
 1 file changed, 9 insertions(+)
712866
712866
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
5c6c2a
index 1ee89bf4..e51b453a 100755
712866
--- a/modules.d/40network/ifup.sh
712866
+++ b/modules.d/40network/ifup.sh
712866
@@ -160,6 +160,15 @@ do_static() {
712866
         return 1
712866
     fi
712866
 
712866
+    ip route get "$ip" | {
712866
+        read a rest
712866
+        if [ "$a" = "local" ]; then
712866
+            warn "Not assigning $ip to interface $netif, cause it is already assigned!"
712866
+            return 1
712866
+        fi
712866
+        return 0
712866
+    } || return 1
712866
+
712866
     [ -n "$macaddr" ] && ip link set address $macaddr dev $netif
712866
     [ -n "$mtu" ] && ip link set mtu $mtu dev $netif
712866
     if strstr $ip '*:*:*'; then