- NetBSD Manual Pages
ARP(9) NetBSD Kernel Developer's Manual ARP(9)
Powered by man-cgi (2021-06-01).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
arp, arp_ifinit, arpresolve, arpintr -- externally visible ARP functions
arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa);
arpresolve(struct ifnet *ifp, const struct rtentry *rt, struct mbuf *m,
const struct sockaddr *dst, void *desten, size_t destlen);
The arp functions provide the interface between the arp module and the
network drivers which need arp functionality. Such drivers must request
the arp attribute in their "files" declaration.
arp_ifinit() Sets up the arp specific fields in ifa. Additionally, it
sends out a gratuitous arp request on ifp, so that other
machines are warned that we have a (new) address and dupli-
cate addresses can be detected.
You must call this in your drivers' ioctl function when you
get a SIOCSIFADDR request with an AF_INET address family.
arpresolve() is called by network output functions to resolve an IPv4
address. If no rt is given, a new one is looked up or cre-
ated. If the passed or found rt does not contain a valid
gateway link level address, a pointer to the packet in m is
stored in the route entry, possibly replacing older stored
packets, and an arp request is sent instead. When an arp
reply is received, the last held packet is send. Other-
wise, the looked up address is returned and written into
the storage desten points to. arpresolve() returns 1, if a
valid address was stored to desten, and the packet can be
sent immediately. Else a 0 is returned.
arpintr() When an arp packet is received, the network driver (class)
input interrupt handler queues the packet on the arpintrq
queue, and requests an arpintr() soft interrupt callback.
arpintr() dequeues the packets, performs sanity checks and
calls (for IPv4 arp packets, which are the only ones sup-
ported currently) the in_arpinput() function.
in_arpinput() either generates a reply to request packets,
and adds the sender address translation to the routing ta-
ble, if a matching route entry is found. If the route
entry contained a pointer to a held packet, that packet is
The ARP code is implemented in sys/net/if_arp.h, sys/netinet/if_inarp.h
Plummer, D., "RFC826", An Ethernet Address Resolution Protocol.
Rewritten to support other than Ethernet link level addresses in
UCB CSRG (original implementation)
Ignatios Souvatzis (support for non-Ethernet)
NetBSD 10.99 September 1, 2019 NetBSD 10.99