This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit d6bd89ff144abae5c1c747ba7882f9087ff8f9ae Author: wenquan1 <[email protected]> AuthorDate: Wed Sep 24 19:45:36 2025 +0800 Revert "net/arp: reducing unnecessary ARP requests can mitigate" This reverts commit 696a94c8055dc59933457e8ce5c3c91dbecab980 first, when continuous ping from tester to vela, if ignore arp expire when ping response use arp_out to build L2 layer, this cause TC13 testing arp entry expire feature failed. second, the patch of support queue iob when arp_out failed can fix this bug. Signed-off-by: wenquan1 <[email protected]> --- net/arp/arp.h | 4 ++-- net/arp/arp_out.c | 2 +- net/arp/arp_send.c | 2 +- net/arp/arp_table.c | 22 +++++----------------- net/netdev/netdev_findbyaddr.c | 3 +-- net/netdev/netdev_ioctl.c | 2 +- 6 files changed, 11 insertions(+), 24 deletions(-) diff --git a/net/arp/arp.h b/net/arp/arp.h index 1f3df14aa22..d1fac3c98e9 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -430,7 +430,7 @@ void arp_notify(in_addr_t ipaddr); struct ether_addr; /* Forward reference */ int arp_find(in_addr_t ipaddr, FAR uint8_t *ethaddr, - FAR struct net_driver_s *dev, bool check_expiry); + FAR struct net_driver_s *dev); /**************************************************************************** * Name: arp_delete @@ -652,7 +652,7 @@ int arp_queue_iob(FAR struct net_driver_s *dev, in_addr_t ipaddr, # define arp_wait_cancel(n) (0) # define arp_wait(n,t) (0) # define arp_notify(i) -# define arp_find(i,e,d,u) (-ENOSYS) +# define arp_find(i,e,d) (-ENOSYS) # define arp_delete(i,d) (-ENOSYS) # define arp_cleanup(d) # define arp_update(d,i,m,f); diff --git a/net/arp/arp_out.c b/net/arp/arp_out.c index db20dab62cb..5193c9860ef 100644 --- a/net/arp/arp_out.c +++ b/net/arp/arp_out.c @@ -254,7 +254,7 @@ void arp_out(FAR struct net_driver_s *dev) /* Check if we already have this destination address in the ARP table */ - ret = arp_find(ipaddr, ethaddr.ether_addr_octet, dev, false); + ret = arp_find(ipaddr, ethaddr.ether_addr_octet, dev); if (ret < 0) { /* No send ARP if the interface forbidden */ diff --git a/net/arp/arp_send.c b/net/arp/arp_send.c index a44bf3dd763..5bd032ef0d0 100644 --- a/net/arp/arp_send.c +++ b/net/arp/arp_send.c @@ -311,7 +311,7 @@ int arp_send(in_addr_t ipaddr) */ netdev_lock(dev); - ret = arp_find(ipaddr, NULL, dev, true); + ret = arp_find(ipaddr, NULL, dev); if (ret >= 0 || ret == -ENETUNREACH) { /* We have it! Break out with ret value */ diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index 8fae076bbe3..9057846fefc 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -192,7 +192,6 @@ arp_return_old_entry(FAR struct arp_entry_s *e1, FAR struct arp_entry_s *e2) * Input Parameters: * ipaddr - Refers to an IP address in network order * dev - Device structure - * check_expiry - Expiry check * * Assumptions: * The network is locked to assure exclusive access to the ARP table. @@ -201,8 +200,7 @@ arp_return_old_entry(FAR struct arp_entry_s *e1, FAR struct arp_entry_s *e2) ****************************************************************************/ static FAR struct arp_entry_s *arp_lookup(in_addr_t ipaddr, - FAR struct net_driver_s *dev, - bool check_expiry) + FAR struct net_driver_s *dev) { FAR struct arp_entry_s *tabptr; int i; @@ -215,15 +213,6 @@ static FAR struct arp_entry_s *arp_lookup(in_addr_t ipaddr, if (tabptr->at_dev == dev && net_ipv4addr_cmp(ipaddr, tabptr->at_ipaddr)) { - /* Find matching entries */ - - if (!check_expiry) - { - return tabptr; /* Ignore expiration time */ - } - - /* Check if it has expired */ - if ((tabptr->at_flags & ATF_PERM) != 0 || clock_systime_ticks() - tabptr->at_time <= ARP_MAXAGE_TICK) { @@ -477,7 +466,6 @@ void arp_hdr_update(FAR struct net_driver_s *dev, FAR uint16_t *pipaddr, * used simply to determine if the Ethernet MAC address is * available. * dev - Device structure - * check_expiry - Expiry check * * Assumptions * The network is locked to assure exclusive access to the ARP table. @@ -485,14 +473,14 @@ void arp_hdr_update(FAR struct net_driver_s *dev, FAR uint16_t *pipaddr, ****************************************************************************/ int arp_find(in_addr_t ipaddr, FAR uint8_t *ethaddr, - FAR struct net_driver_s *dev, bool check_expiry) + FAR struct net_driver_s *dev) { FAR struct arp_entry_s *tabptr; struct arp_table_info_s info; /* Check if the IPv4 address is already in the ARP table. */ - tabptr = arp_lookup(ipaddr, dev, check_expiry); + tabptr = arp_lookup(ipaddr, dev); if (tabptr != NULL) { /* Addresses that have failed to be searched will return a special @@ -575,7 +563,7 @@ int arp_delete(in_addr_t ipaddr, FAR struct net_driver_s *dev) #endif /* Check if the IPv4 address is in the ARP table. */ - tabptr = arp_lookup(ipaddr, dev, false); + tabptr = arp_lookup(ipaddr, dev); if (tabptr != NULL) { /* Notify to netlink */ @@ -705,7 +693,7 @@ int arp_queue_iob(FAR struct net_driver_s *dev, in_addr_t ipaddr, /* the IPv4 address should in the ARP table and arp in progress. */ - tabptr = arp_lookup(ipaddr, dev, false); + tabptr = arp_lookup(ipaddr, dev); if (tabptr && memcmp(&tabptr->at_ethaddr, &g_zero_ethaddr, sizeof(tabptr->at_ethaddr)) == 0) { diff --git a/net/netdev/netdev_findbyaddr.c b/net/netdev/netdev_findbyaddr.c index b89ed6e43bf..1c5a3075361 100644 --- a/net/netdev/netdev_findbyaddr.c +++ b/net/netdev/netdev_findbyaddr.c @@ -128,8 +128,7 @@ netdev_prefixlen_findby_lipv4addr(in_addr_t lipaddr, FAR int8_t *prefixlen) if (len > bestpref #ifdef CONFIG_NET_ARP - || (len == bestpref - && arp_find(lipaddr, NULL, dev, true) == OK) + || (len == bestpref && arp_find(lipaddr, NULL, dev) == OK) #endif ) { diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 70b05275f7d..39217a0e9b4 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -1523,7 +1523,7 @@ static int netdev_arp_ioctl(FAR struct socket *psock, int cmd, req->arp_pa.sa_family == AF_INET) { ret = arp_find(addr->sin_addr.s_addr, - (FAR uint8_t *)req->arp_ha.sa_data, dev, true); + (FAR uint8_t *)req->arp_ha.sa_data, dev); if (ret >= 0) { /* Return the mapped hardware address. */
