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 <wenquan1@xiaomi.com>
This commit is contained in:
wenquan1
2025-09-24 19:45:36 +08:00
committed by Xiang Xiao
parent 5b52ab13c8
commit d6bd89ff14
6 changed files with 11 additions and 24 deletions
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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 */
+5 -17
View File
@@ -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)
{
+1 -2
View File
@@ -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
)
{
+1 -1
View File
@@ -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. */