diff --git a/include/nuttx/net/arp.h b/include/nuttx/net/arp.h index 35b8b4a5c58..b7bddeedb36 100644 --- a/include/nuttx/net/arp.h +++ b/include/nuttx/net/arp.h @@ -186,47 +186,6 @@ void arp_arpin(struct net_driver_s *dev); void arp_out(FAR struct net_driver_s *dev); -/**************************************************************************** - * Name: arp_find - * - * Description: - * Find the ARP entry corresponding to this IP address. - * - * Input parameters: - * ipaddr - Refers to an IP address in network order - * - * Assumptions - * Interrupts are disabled; Returned value will become unstable when - * interrupts are re-enabled or if any other uIP APIs are called. - * - ****************************************************************************/ - -FAR struct arp_entry *arp_find(in_addr_t ipaddr); - -/**************************************************************************** - * Name: arp_delete - * - * Description: - * Remove an IP association from the ARP table - * - * Input parameters: - * 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). - * - ****************************************************************************/ - -#define arp_delete(ipaddr) \ -{ \ - struct arp_entry *tabptr = arp_find(ipaddr); \ - if (tabptr) \ - { \ - tabptr->at_ipaddr = 0; \ - } \ -} - /**************************************************************************** * Name: arp_update * @@ -234,6 +193,13 @@ FAR struct arp_entry *arp_find(in_addr_t ipaddr); * Add the IP/HW address mapping to the ARP table -OR- change the IP * address of an existing association. * + * NOTE: This is an internal interface withint the networking layer and + * should not be used by application software. This prototype is here + * because there is already a violation of this structureing: The + * apps/netutils/dhcpd logic currently calls arp_update() directly. That + * is bad and needs to be replace with some ioctl interface perhaps hidden + * somewhere in apps/netutils/netlib. + * * Input parameters: * pipaddr - Refers to an IP address uint16_t[2] in network order * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] diff --git a/net/arp/arp.h b/net/arp/arp.h index 75119fc51af..7f40fe381e7 100644 --- a/net/arp/arp.h +++ b/net/arp/arp.h @@ -281,6 +281,65 @@ int arp_send(in_addr_t ipaddr); int arp_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback); #endif +/**************************************************************************** + * Name: arp_find + * + * Description: + * Find the ARP entry corresponding to this IP address. + * + * Input parameters: + * ipaddr - Refers to an IP address in network order + * + * Assumptions + * Interrupts are disabled; Returned value will become unstable when + * interrupts are re-enabled or if any other uIP APIs are called. + * + ****************************************************************************/ + +FAR struct arp_entry *arp_find(in_addr_t ipaddr); + +/**************************************************************************** + * Name: arp_delete + * + * Description: + * Remove an IP association from the ARP table + * + * Input parameters: + * 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). + * + ****************************************************************************/ + +#define arp_delete(ipaddr) \ +{ \ + struct arp_entry *tabptr = arp_find(ipaddr); \ + if (tabptr) \ + { \ + tabptr->at_ipaddr = 0; \ + } \ +} + +/**************************************************************************** + * Name: arp_update + * + * Description: + * Add the IP/HW address mapping to the ARP table -OR- change the IP + * address of an existing association. + * + * Input parameters: + * pipaddr - Refers to an IP address uint16_t[2] in network order + * ethaddr - Refers to a HW address uint8_t[IFHWADDRLEN] + * + * Assumptions + * Interrupts are disabled to assure exclusive access to the ARP table. + * + ****************************************************************************/ + +void arp_update(FAR uint16_t *pipaddr, FAR uint8_t *ethaddr); + /**************************************************************************** * Name: arp_dump *