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