Skip to content

Commit 3811fff

Browse files
xanoxeshanhuihui
authored andcommitted
retry arping one more time in ifup-eth when sendto failed
1 parent 5c61fd7 commit 3811fff

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

network-scripts/ifup-eth

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,18 @@ 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+
while [ "${tries}" -le "${ARPING_TRIES}" ]; do
297+
ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})
298+
[ $? = 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+
tries=$((tries+1))
305+
done
306+
if [ "${tries}" -gt "${ARPING_TRIES}" ]; then
307+
net_log $"arping failed after $tries tries"
300308
exit 1
301309
fi
302310
fi

0 commit comments

Comments
 (0)