Skip to content

Commit 6ae9473

Browse files
xanoxesjamacku
authored andcommitted
retry arping one more time in ifup-eth when sendto failed
1 parent 12dbdf1 commit 6ae9473

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

network-scripts/ifup-eth

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,17 @@ else
293293

294294
if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then
295295
if [ "${REALDEVICE}" != "lo" ] && ! is_false "${arpcheck[$idx]}"; then
296-
ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})
297-
if [ $? = 1 ]; then
296+
for (( tries=0; tries<${ARPING_TRIES:=1}; tries++ )); do
297+
ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})
298+
[ "$?" -eq 0 ] && break
298299
ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p')
299-
net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
300+
if [ -n "${ARPINGMAC}" ]; then
301+
net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
302+
exit 1
303+
fi
304+
done
305+
if [ "${tries}" -eq "${ARPING_TRIES}" ]; then
306+
net_log $"arping failed after $tries tries"
300307
exit 1
301308
fi
302309
fi

0 commit comments

Comments
 (0)