arp(7P)
NAME
arp − Address Resolution Protocol
DESCRIPTION
ARP is a protocol used to dynamically map between DARPA Internet and hardware station addresses. It is used by all LAN drivers.
ARP caches Internet-to-hardware station address mappings. When an interface requests a mapping for an address not in the cache, ARP queues the message that requires the mapping, and broadcasts a message on the associated network requesting the address mapping if the ether encapsulation method has been enabled for the interface. If a response is provided, the new mapping is cached and any pending message is transmitted. ARP queues at most one packet while waiting for a mapping request to be responded to; only the most recently “transmitted” packet is kept.
To facilitate communications with systems that do not use ARP, ioctls are provided to enter and delete entries in the Internet-to-hardware station address tables. Usage:
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/if_ether.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 can be applied to any socket descriptor s, but only by the super-user. The arpreq structure contains:
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
u_char rif[18]; /* 802.5 source routing information */
int arp_flags; /* flags */
};
/* arp_flags field values */
#define ATF_COM 0x02 /* ARP on ether */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry */
#define ATF_USETRAILERS 0x10 /* trailer packets */
#define ATF_ETHERXT 0x20 /* PROBE on ether */
#define ATF_IEEE8023 0x40 /* PROBE on ieee */
#define ATF_SNAPFDDI 0x200 /* SNAP - FDDI */
#define ATF_SNAP8025 0x400 /* SNAP - 8025 */
#define ATF_IEEE8025 0x800 /* IEEE - 8025 */
#define ATF_FCSNAP 0x4000 /* Fibre Channel SNAP */
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, ATF_PUBL, and ATF_USETRAILERS. Fibre Channel hosts only support the ATF_PERM flag. ATF_PERM causes the entry to be permanent. ATF_PUBL specifies that the ARP code should respond to ARP requests for the indicated host coming from other machines. This allows a host to act as an ARP server, which may be useful in convincing an ARP -only machine to talk to a non- ARP machine.
ARP is also used to negotiate the use of trailer IP encapsulations; trailers are an alternate encapsulation used to allow efficient packet alignment for large packets despite variable-sized headers. Hosts that want to receive trailer encapsulations indicate so by sending gratuitous ARP translation replies along with replies to IP requests; they are also sent in reply to IP translation replies. The negotiation is thus fully symmetrical, in that either or both hosts can request trailers. The ATF_USETRAILERS flag is used to record the receipt of such a reply, and enables the transmission of trailer packets to that host. Fibre Channel hosts do not support the ATF_USETRAILERS flag.
ARP watches passively for hosts impersonating the local host (i.e., a host that responds to an ARP mapping request for the local host’s address).
AUTHOR
ARP was developed by the University of California, Berkeley.
WARNINGS
HP 9000 systems can receive trailer packets but do not send them. Setting the trailers flag has no effect.
To enable the ‘ether’ encapsulation method, use the lanconfig command (see lanconfig(1M)).
DIAGNOSTICS
duplicate IP address!! sent from ethernet address: %x:%x:%x:%x:%x:%x.
This message printed on the console screen means that ARP has discovered another host on the local network that responds to mapping requests for its own Internet address.
SEE ALSO
ifconfig(1M), inet(3N), lanconfig(1M), lan(7), arp(1M).
An Ethernet Address Resolution Protocol, RFC826, Dave Plummer, Network Information Center, SRI.
Trailer Encapsulations, RFC893, S.J. Leffler and M.J. Karels, Network Information Center, SRI.
Hewlett-Packard Company — HP-UX Release 10.20: July 1996