arp(7) arp(7)
NAME
arp - Address Resolution Protocol
DESCRIPTION
ARP is a protocol used to map dynamically between Internet Protocol
(IP) and MAC addresses for Ethernet, FDDI and Token Ring interfaces.
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 net-
work 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/ifarp.h>
struct arpreq arpreq;
int d;
struct arpreq;
struct strioctl ioc;
d=open ("/dev/arp", ORDWR);
ioc.iccmd = cmd; /* cmd is SIOCSARP or
SIOCGARP or SIOCDARP */
ioc.ictimeout = 0;
ioc.iclen = sizeof(struct arpreq);
ioc.icdp = &arpreq;
ioctl(d, ISTR, (caddrt)&ioc);
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 Internet fam-
ily socket descriptor s, or to a descriptor for the ARP device, but
only by the privileged user. The arpreq structure contains:
Page 1 Reliant UNIX 5.44 Printed 11/98
arp(7) arp(7)
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arppa; /* protocol address */
struct sockaddr arpha; /* hardware address */
int arpflags; /* flags */
};
/* arpflags field values */
#define ATFCOM 0x2 /* completed entry (arpha valid) */
#define ATFPERM 0x4 /* permanent entry */
#define ATFPUBL 0x8 /* publish (respond for other host) */
#define ATFUSETRAILERS 0x10 /* send trailer packets to host */
The address family for the arppa sockaddr must be AFINET; for the
arpha sockaddr it must be AFUNSPEC. The only flag bits that may be
written are ATFPERM, ATFPUBL and ATFUSETRAILERS. ATFPERM 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. ATFPUBL 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.
IP trailer encapsulation is currently not supported by Reliant UNIX.
The ATFUSETRAILERS option therefore has no significance.
ARP monitors the network passively for ARP responses from other, sys-
tems which are responding to requests from the local system.
SEE ALSO
arp(1M), ifconfig(1M), if(7), inet(7).
REFERENCES
Plummer, Dave, An Ethernet Address Resolution Protocol -or- Converting
Network Protocol Addresses to 48.bit Ethernet Addresses for Transmis-
sion on Ethernet Hardware, RFC 826, Network Information Center, SRI
International, Menlo Park, Calif., November 1982.
Leffler, Sam, and Michael Karels, Trailer Encapsulations, RFC 893,
Network Information Center, SRI International, Menlo Park, Calif.,
April 1984.
Page 2 Reliant UNIX 5.44 Printed 11/98