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

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