net/arp: add timeout to avoid infinite send wait

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

Change-Id: I839a5fe1fb64b7d6eee7ad28d93d2b27f067b915
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2021-02-22 10:35:18 +08:00
parent 3cc8acd454
commit a77d103263
+7 -1
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,7 @@ int arp_send(in_addr_t ipaddr)
break;
}
timeout:
/* Increment the retry count */
state.snd_retries++;