Skip to content

Commit

Permalink
retry arping one more time in ifup-eth when sendto failed
Browse files Browse the repository at this point in the history
  • Loading branch information
xanoxes authored and century6 committed Oct 15, 2024
1 parent 5c61fd7 commit a62a079
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions network-scripts/ifup-eth
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a62a079

Please sign in to comment.