network/ifup.sh:do_static(): error out, if IP is already assigned

(cherry picked from commit 32770ca79a)
master
Harald Hoyer 2015-08-19 14:00:28 +02:00
parent 5193198dc9
commit 27a5aecf56
1 changed files with 9 additions and 0 deletions

View File

@ -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