ARP(7) ARP(7)
NAME
ARP - Address Resolution Protocol
SYNOPSIS
arp
DESCRIPTION
ARP is a protocol used to map dynamically between Internet
Protocol (IP) and 10Mb/s Ethernet addresses. It is used by
all the 10Mb/s Ethernet datalink providers (interface
drivers). It is not specific to the Internet Protocol or to
the 10Mb/s Ethernet, but this implementation currently
supports only that combination. The STREAMS device /dev/arp
is not a Transport Level Interface (TLI) transport provider
and may not be used with the TLI interface.
ARP caches IP-to-Ethernet 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
a response is provided, the new mapping is cached and any
pending message is transmitted. ARP will queue 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 which do not use
ARP, ioctl requests are provided to enter and delete entries
in the IP-to-Ethernet tables.
USAGE
#include <sys/sockio.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_arp.h>
struct arpreq arpreq;
ioctl(s, SIOCSARP, (caddr_t)&arpreq);
ioctl(s, SIOCGARP, (caddr_t)&arpreq);
ioctl(s, SIOCDARP, (caddr_t)&arpreq);
Each ioctl request takes the same structure as an argument.
SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and
SIOCDARP deletes an ARP entry. These ioctl requests may be
applied to any descriptor for the ARP device, but only by a
privileged user. The arpreq structure contains:
Copyright 1994 Novell, Inc. Page 1
ARP(7) ARP(7)
/*
* 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_INUSE 0x01 /* entry in use */
#define ATF_COM 0x2 /* completed entry (arp_ha valid) */
#define ATF_PERM 0x4 /* permanent entry */
#define ATF_PUBL 0x8 /* publish (respond for other host) */
#define ATF_USETRAILERS 0x10 /* send trailer packets to 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 may be written are ATF_PERM, ATF_PUBL and
ATF_USETRAILERS. ATF_PERM makes the entry permanent if the
ioctl request succeeds. The peculiar nature of the ARP tables
may cause the ioctl request to fail if too many permanent IP
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 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 wish to receive trailer
encapsulations so indicate 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 may 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.
ARP watches passively for hosts impersonating the local host
(that is, a host which responds to an ARP mapping request for
the local host's address).
REFERENCES
arp(1M), if(7), ifconfig(1M), inet(7)
RFC 826, RFC 893
Copyright 1994 Novell, Inc. Page 2