From 34a84d9e9db6b1732d35f0752b2d7e833ce6b338 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Thu, 24 Jul 2014 14:55:55 +0200 Subject: ifup-aliases: improve duplicate address detection --- sysconfig/network-scripts/ifup-aliases | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index c92a431d..b821eee8 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -257,13 +257,15 @@ function new_interface () fi if [ "$setup_this" = "yes" ] ; then - [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \ + if [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \ is_available ${parent_device} && \ - grep -qswi "up" /sys/class/net/${parent_device}/operstate && \ - if ! /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR} ; then - net_log $"Error, some other host already uses address ${IPADDR}." - return 1 - fi + ( grep -qswi "up" /sys/class/net/${parent_device}/operstate || grep -qswi "1" /sys/class/net/${parent_device}/carrier ) ; then + echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..." + if ! /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR} ; then + net_log $"Error, some other host already uses address ${IPADDR}." + return 1 + fi + fi /sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} dev ${parent_device} label ${DEVICE} -- cgit v1.2.1