]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
net/arp: account for ARP delay, avoid duplicate packets on timeout
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sun, 30 Aug 2015 15:46:54 +0000 (17:46 +0200)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 28 Oct 2015 19:57:37 +0000 (14:57 -0500)
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 <stefan.bruens@rwth-aachen.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/arp.c
net/arp.h
net/net.c

index b1f12bf10ddf1cb1affb1845a24e7f478f049cfd..824d2e9393550ea250f357b2762cf2f465e5fe66 100644 (file)
--- 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)
index 43c6296f7e83f930aac2ca1289646c256ca8175a..a288d618b6849a329a919d0d768f0ab142a46ace 100644 (file)
--- a/net/arp.h
+++ b/net/arp.h
@@ -25,7 +25,7 @@ void arp_init(void);
 void arp_request(void);
 void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,
        struct in_addr target_ip);
-void arp_timeout_check(void);
+int arp_timeout_check(void);
 void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
 
 #endif /* __ARP_H__ */
index a115ce28927216532179bdcc842d22025e0ee092..6f75e3ce06c8d587628b629fe70eba4846a3f236 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -569,7 +569,9 @@ restart:
                        goto done;
                }
 
-               arp_timeout_check();
+               if (arp_timeout_check() > 0) {
+                   time_start = get_timer(0);
+               }
 
                /*
                 *      Check for a timeout, and run the timeout handler