From: Harald Hoyer Date: Wed, 19 Aug 2015 12:00:28 +0000 (+0200) Subject: network/ifup.sh:do_static(): error out, if IP is already assigned X-Git-Tag: 044~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27a5aecf56fbfa9a8d92d86d7e68c2781c0b4523;p=thirdparty%2Fdracut.git network/ifup.sh:do_static(): error out, if IP is already assigned (cherry picked from commit 32770ca79a1f6828ca9fdf4b6841e6a6d4e4754a) --- diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh index 69a4567bb..381ff43b3 100755 --- a/modules.d/40network/ifup.sh +++ b/modules.d/40network/ifup.sh @@ -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