Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

arpintr(9) [netbsd man page]

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

NAME
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
RFC 826 HISTORY
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

arp(4p) 																   arp(4p)

Name
       arp - Address Resolution Protocol

Syntax
       pseudo-device ether

Description
       The  ARP  protocol  is used to map dynamically between DARPA Internet and 10Mb/s Ethernet addresses.  It is used by all the 10Mb/s Ethernet
       interface drivers.

       The ARP protocol caches Internet-Ethernet address mappings.  When an interface requests a mapping for an address  not  in  the  cache,  ARP
       queues  the  message  which  requires  the mapping and broadcasts a message on the associated network requesting the address mapping.  If a
       response is provided, the new mapping is cached and any pending messages are transmitted.  The ARP protocol queues only the  most  recently
       ``transmitted'' packet while waiting for a mapping request to be responded to.

       To  enable  communications  with  systems which do not use ARP, ioctls are provided to enter and delete entries in the Internet-to-Ethernet
       tables.	The usage is:
       #include <sys/ioctl.h>
       #include <sys/socket.h>
       #include <net/if.h>
       struct arpreq arpreq;

       ioctl(s, SIOCSARP, (caddr_t)&arpreq);
       ioctl(s, SIOCGARP, (caddr_t)&arpreq);
       ioctl(s, SIOCDARP, (caddr_t)&arpreq);

       Each ioctl takes the same structure as an argument.  SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP  deletes  an  ARP
       entry.  These ioctls may be applied to any socket descriptor s, but only by the superuser.  The arpreq structure contains:
       /*
	* ARP ioctl request
	*/
       struct arpreq {
	   struct sockaddr   arp_pa;	 /* protocol address */
	   struct sockaddr   arp_ha;	 /* hardware address */
	   int		     arp_flags;  /* flags */
       };
       /*  arp_flags field values */
       #define ATF_COM	2   /* completed entry (arp_ha valid) */
       #define	 ATF_PERM 4   /* permanent entry */
       #define	 ATF_PUBL 8   /* publish (respond for other host) */

       The  address family for the arp_pa sockaddr must be AF_INET; for the arp_ha sockaddr, it must be AF_UNSPEC.  The only flag bits that can be
       written are ATF_PERM and ATF_PUBL.  ATF_PERM causes the entry to be permanent if the ioctl call succeeds.  The ioctl may fail if more  than
       four  permanent Internet host addresses hash to the same slot.  ATF_PUBL specifies that the ARP code should respond to ARP requests for the
       indicated host coming from other machines.  This lets a SUN act as an ARP server, which can be used to make an ARP-only machine talk  to  a
       non-ARP machine.

       The ARP protocol watches passively for a host that responds to an ARP mapping request for the local host's address.

Restrictions
       ARP  packets  on the Ethernet use only 42 bytes of data.  The smallest legal Ethernet packet is 60 bytes, however, not including CRC.  Some
       systems may not enforce the minimum packet size.

Diagnostics
       duplicate IP address!! sent from Ethernet address: %x:%x:%x:%x:%x:%x
       ARP has discovered another host on the local network that responds to mapping requests for its own Internet address.

See Also
       inet(4f), arp(8c), ifconfig(8c)

																	   arp(4p)
Man Page