Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

arp(9) [netbsd man page]

ARP(9)							   BSD Kernel Developer's Manual						    ARP(9)

arp, arp_ifinit, arpresolve, arpintr -- externally visible ARP functions SYNOPSIS
#include <netinet/if_inarp.h> void arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa); int arpresolve(struct ifnet *ifp, struct rtentry *rt, struct mbuf *m, struct sockaddr *dst, u_char *desten); void arpintr(); DESCRIPTION
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 duplicate 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 created. 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. Otherwise, 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 supported currently) the in_arpinput() function. in_arpinput() either generates a reply to request packets, and adds the sender address translation to the routing table, if a matching route entry is found. If the route entry contained a pointer to a held packet, that packet is sent. SEE ALSO
ether_ifattach(9) Plummer, D., "RFC826", An Ethernet Address Resolution Protocol. STANDARDS
Rewritten to support other than Ethernet link level addresses in NetBSD 1.3. AUTHORS
UCB CSRG (original implementation) Ignatios Souvatzis (support for non-Ethernet) CODE REFERENCES
The ARP code is implemented in sys/net/if_arp.h, sys/netinet/if_inarp.h and sys/netinet/if_arp.c. BSD
March 3, 1997 BSD

Check Out this Related Man Page

ETHERSUBR(9)						   BSD Kernel Developer's Manual					      ETHERSUBR(9)

ethersubr, ether_ifattach, ether_addmulti, ether_delmulti, ETHER_FIRST_MULTI, ETHER_NEXT_MULTI, ETHER_IS_MULTICAST, fddi_ifattach, fddi_addmulti, fddi_delmulti -- Ethernet and FDDI driver support functions and macros SYNOPSIS
#include <net/if_ether.h> void ether_ifattach(struct ifnet *ifp, uint8_t *lla); int ether_addmulti(const struct sockaddr *sa, struct ethercom *ec); int ether_delmulti(const struct sockaddr *sa, struct ethercom *ec); void ETHER_FIRST_MULTI(struct ether_multistep step, struct ethercom *ec, struct ether_multi *enm); void ETHER_NEXT_MULTI(struct ether_multistep step, struct ether_multi *enm); int ETHER_IS_MULTICAST(uint8_t *addr); #include <net/if_fddi.h> void fddi_ifattach(struct ifnet *ifp, uint8_t *lla); int fddi_addmulti(const struct sockaddr *sa, struct ethercom *ec); int fddi_delmulti(const struct sockaddr *sa, struct ethercom *ec); DESCRIPTION
The ethersubr functions provide the interface between the ethersubr module and the network drivers which need Ethernet support. Such drivers must request the ether attribute in their files declaration and call the appropriate functions as specified below. FDDI drivers must request the "fddi" attribute in their "files" declaration and call the functions tagged with "fddi_" or "FDDI_" instead, where different. Some macros are shared. Note that you also need the arp(9) stuff to support IPv4 on your hardware. ether_ifattach(ifp, lla) Perform the device-independent, but Ethernet-specific initialization of the interface pointed to by ifp. Among other duties, this function creates a record for the link level address in the interface's address list and records the link level address pointed to by lla there. This function must be called from the driver's attach function. fddi_ifattach(ifp, lla) Corresponding function for FDDI devices. ether_addmulti(sa, ec) ether_delmulti(sa, ec) Add (ether_addmulti()) or delete (ether_delmulti()) the address described by the sa pointer to the Ethernet multicast list belonging to ec. These functions must be called from the driver's ioctl function to handle SIOCADDMULTI and SIOCDELMULTI requests. If these return ENETRESET, the hardware multicast filter must be reinitialized. These functions accept AF_UNSPEC addresses, which are interpreted as Ethernet addresses, or AF_INET addresses. In the latter case, INADDR_ANY is mapped to a range describing all the Ethernet address space reserved for IPv4 multicast addresses. The ether_addmulti() returns EAFNOSUPPORT if an unsupported address family is specified, EINVAL if a non-multicast address is speci- fied, or ENETRESET if the multicast list really changed and the driver should synchronize its hardware filter with it. The ether_delmulti() returns, in addition to the above errors, ENXIO if the specified address can't be found in the list of multi- cast addresses. fddi_addmulti(sa, ec) fddi_delmulti(sa, ec) Corresponding functions for FDDI devices. ETHER_NEXT_MULTI(step, enm) A macro to step through all of the ether_multi records, one at a time. The current position is remembered in step, which the caller must provide. ETHER_FIRST_MULTI(step, ec, enm) A macro that must be called to initialize step and get the first record. Both macros return a NULL enm when there are no remaining records. ETHER_IS_MULTICAST(addr) A macro that returns 1, if addr points to an Ethernet/FDDI multicast (or broadcast) address. SEE ALSO
arp(9) HISTORY
Rewritten to attach to the new ARP system in NetBSD 1.3. AUTHORS
UCB CSRG (original implementation) Ignatios Souvatzis (support for new ARP system) CODE REFERENCES
Ethernet support functions are declared in <net/if_ether.h> and defined (if not implemented as macro) in sys/net/if_ethersubr.c. FDDI support functions are declared in <net/if_fddi.h> and defined (if not implemented as macro) in sys/net/if_fddisubr.c. BSD
March 3, 1997 BSD
Man Page