diff --git a/net/arp/arp.h b/net/arp/arp.h index a065cbe1611..79a0d9a14f6 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -379,7 +379,8 @@ void arp_notify(in_addr_t ipaddr); * ipaddr - Refers to an IP address in network order * * Assumptions: - * The network is locked. + * The network is locked to assure exclusive access to the ARP table. + * The return value will become unstable when the network is unlocked. * ****************************************************************************/ @@ -397,7 +398,7 @@ FAR struct arp_entry *arp_lookup(in_addr_t ipaddr); * entry - location to return a copy of the ARP table entry. * * Assumptions - * The network is locked. + * The network is locked to assure exclusive access to the ARP table. * ****************************************************************************/ @@ -413,8 +414,7 @@ int arp_find(in_addr_t ipaddr, FAR struct arp_entry *entry); * ipaddr - Refers to an IP address in network order * * Assumptions - * Interrupts are disabled to assure exclusive access to the ARP table - * (and because arp_find() is called). + * The network is locked to assure exclusive access to the ARP table. * ****************************************************************************/ diff --git a/net/arp/arp_table.c b/net/arp/arp_table.c index 611c64608ea..292b942cb65 100644 --- a/net/arp/arp_table.c +++ b/net/arp/arp_table.c @@ -294,7 +294,8 @@ void arp_hdr_update(FAR uint16_t *pipaddr, FAR uint8_t *ethaddr) * ipaddr - Refers to an IP address in network order * * Assumptions: - * The network is locked. + * The network is locked to assure exclusive access to the ARP table. + * The return value will become unstable when the network is unlocked. * ****************************************************************************/ @@ -330,7 +331,7 @@ FAR struct arp_entry *arp_lookup(in_addr_t ipaddr) * ipaddr - Refers to an IP address in network order * * Assumptions: - * The network is locked. + * The network is locked to assure exclusive access to the ARP table. * ****************************************************************************/ @@ -350,8 +351,8 @@ int arp_find(in_addr_t ipaddr, FAR struct arp_entry *entry) } /* No.. check if the IPv4 address is the address assigned to a local - * Ethernet network device. If so, return a "fake" arp table entry - * mapping that IP address to the Ethernet MAC address of the device. + * Ethernet network device. If so, return a mapping of that IP address + * to the Ethernet MAC address assigned to the network device. */ entry->at_ipaddr = ipaddr; @@ -375,8 +376,7 @@ int arp_find(in_addr_t ipaddr, FAR struct arp_entry *entry) * ipaddr - Refers to an IP address in network order * * Assumptions - * Interrupts are disabled to assure exclusive access to the ARP table - * (and because arp_find() is called). + * The network is locked to assure exclusive access to the ARP table. * ****************************************************************************/ @@ -389,7 +389,7 @@ void arp_delete(in_addr_t ipaddr) tabptr = arp_lookup(ipaddr); if (tabptr != NULL) { - /* Yes.. set the IP address to zero to "delete" it */ + /* Yes.. Set the IP address to zero to "delete" it */ tabptr->at_ipaddr = 0; } diff --git a/net/ipforward/ipfwd_forward.c b/net/ipforward/ipfwd_forward.c index d92f1e9ca20..9323e3d8f76 100644 --- a/net/ipforward/ipfwd_forward.c +++ b/net/ipforward/ipfwd_forward.c @@ -161,7 +161,7 @@ static inline bool ipfwd_addrchk(FAR struct forward_s *fwd) FAR struct ipv4_hdr_s *ipv4 = (FAR struct ipv4_hdr_s *)fwd->f_iob->io_data; struct arp_entry entry; int ret; - + ret = arp_find(*(in_addr_t *)ipv4->destipaddr, &entry); return (ret >= 0); #else