diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index de6af876..a9c78e1e 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -293,10 +293,21 @@ else if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then if [ "${REALDEVICE}" != "lo" ] && ! is_false "${arpcheck[$idx]}"; then - ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]}) - if [ $? = 1 ]; then - ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p') - net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}." + while [ "${tries}" -le "${ARPING_TRIES}" ]; do + ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]}) + if [ $? = 1 ]; then + ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p') + if [ -n "${ARPINGMAC}" ]; then + net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}." + break + fi + tries=$((tries+1)) + else + break + fi + done + if [ "${tries}" -gt "${ARPING_TRIES}" ]; then + net_log $"arping failed after $tries tries" exit 1 fi fi