From 45b47734a0788721c76e3bb621a5133554e0a640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 30 Aug 2015 17:46:54 +0200 Subject: net/arp: account for ARP delay, avoid duplicate packets on timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit eth_rx() in the main reception loop may trigger sending a packet which is already timed out (or will immediately) upon reception of an ARP reply. As long as the ARP reply is pending, the timeout handler of a packet should be postponed. Happens on TFTP with bad network (e.g. WLAN). Signed-off-by: Stefan BrĂ¼ns Acked-by: Joe Hershberger --- net/arp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'net/arp.c') diff --git a/net/arp.c b/net/arp.c index b1f12bf..824d2e9 100644 --- a/net/arp.c +++ b/net/arp.c @@ -96,12 +96,12 @@ void arp_request(void) arp_raw_request(net_ip, net_null_ethaddr, net_arp_wait_reply_ip); } -void arp_timeout_check(void) +int arp_timeout_check(void) { ulong t; if (!net_arp_wait_packet_ip.s_addr) - return; + return 0; t = get_timer(0); @@ -118,6 +118,7 @@ void arp_timeout_check(void) arp_request(); } } + return 1; } void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) -- cgit v1.1