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
1 changed files with 8 additions and 1 deletions

View File

@ -337,7 +337,12 @@ int arp_send(in_addr_t ipaddr)
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);
@ -367,6 +372,8 @@ int arp_send(in_addr_t ipaddr)
break;
}
timeout:
/* Increment the retry count */
state.snd_retries++;