From ffbe075d5623c44bbf37618cce78d09ccd4e6760 Mon Sep 17 00:00:00 2001
From: Florent Matignon <florent.matignon@gmail.com>
Date: Thu, 20 Sep 2018 16:40:34 +0200
Subject: [PATCH] bug #54700: Unexpected expiry of pending ARP table entry
New etharp queries should restart the 5 second timeout on the ARP
table entry if it is still pending.
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
Conflict: NA
Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=ffbe075d5623c44bbf37618cce78d09ccd4e6760
---
 src/core/ipv4/etharp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c
index 442aac0..c3a5a10 100644
--- a/src/core/ipv4/etharp.c
+++ b/src/core/ipv4/etharp.c
@@ -983,6 +983,14 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
       /* We don't re-send arp request in etharp_tmr, but we still queue packets,
          since this failure could be temporary, and the next packet calling
          etharp_query again could lead to sending the queued packets. */
+    } else {
+      /* ARP request successfully sent */
+      if ((arp_table[i].state == ETHARP_STATE_PENDING) && !is_new_entry) {
+        /* A new ARP request has been sent for a pending entry. Reset the ctime to
+           not let it expire too fast. */
+        LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: reset ctime for entry %"S16_F"\n", (s16_t)i));
+        arp_table[i].ctime = 0;
+      }
     }
     if (q == NULL) {
       return result;
-- 
1.8.3.1

