]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network/ifup.sh:do_static(): error out, if IP is already assigned
authorHarald Hoyer <harald@redhat.com>
Wed, 19 Aug 2015 12:00:28 +0000 (14:00 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 11 Nov 2015 15:16:09 +0000 (16:16 +0100)
(cherry picked from commit 32770ca79a1f6828ca9fdf4b6841e6a6d4e4754a)

modules.d/40network/ifup.sh

index 69a4567bbfc553ec1afec5955c314c5f6fa287c7..381ff43b3d90a315a75e79a69f4fe476d88d2475 100755 (executable)
@@ -155,6 +155,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 strglobin $ip '*:*:*'; then