net/arp: add timeout to avoid infinite send wait

add timeout to avoid infinite send wait if the network device is unreachable

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-02-22 10:35:18 +08:00 committed by Xiang Xiao
parent 4abf8e6587
commit 9bdf4ccd68

View File

@ -337,7 +337,12 @@ int arp_send(in_addr_t ipaddr)
do do
{ {
net_lockedwait(&state.snd_sem); ret = net_timedwait_uninterruptible(&state.snd_sem,
CONFIG_ARP_SEND_DELAYMSEC);
if (ret == -ETIMEDOUT)
{
goto timeout;
}
} }
while (!state.snd_sent); while (!state.snd_sent);
@ -367,6 +372,8 @@ int arp_send(in_addr_t ipaddr)
break; break;
} }
timeout:
/* Increment the retry count */ /* Increment the retry count */
state.snd_retries++; state.snd_retries++;