You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
949 B

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