1ARP(4P) ARP(4P)
2
3
4
6 arp - Address Resolution Protocol
7
9 /sys/conf/SYSTEM:
10 NETHER 1 # ether pseudo-device
11
13 ARP is a protocol used to dynamically map between DARPA Internet and
14 10Mb/s Ethernet addresses. It is used by all the 10Mb/s Ethernet
15 interface drivers. It is not specific to Internet protocols or to
16 10Mb/s Ethernet, but this implementation currently supports only that
17 combination.
18
19 ARP caches Internet-Ethernet address mappings. When an interface
20 requests a mapping for an address not in the cache, ARP queues the mes‐
21 sage which requires the mapping and broadcasts a message on the associ‐
22 ated network requesting the address mapping. If a response is pro‐
23 vided, the new mapping is cached and any pending message is transmit‐
24 ted. ARP will queue at most one packet while waiting for a mapping
25 request to be responded to; only the most recently ``transmitted''
26 packet is kept.
27
28 To facilitate communications with systems which do not use ARP, ioctls
29 are provided to enter and delete entries in the Internet-to-Ethernet
30 tables. Usage:
31
32 #include <sys/ioctl.h>
33 #include <sys/socket.h>
34 #include <net/if.h>
35 struct arpreq arpreq;
36
37 ioctl(s, SIOCSARP, (caddr_t)&arpreq);
38 ioctl(s, SIOCGARP, (caddr_t)&arpreq);
39 ioctl(s, SIOCDARP, (caddr_t)&arpreq);
40 Each ioctl takes the same structure as an argument. SIOCSARP sets an
41 ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP deletes an ARP
42 entry. These ioctls may be applied to any socket descriptor s, but
43 only by the super-user. The arpreq structure contains:
44
45 /*
46 * ARP ioctl request
47 */
48 struct arpreq {
49 struct sockaddr arp_pa; /* protocol address */
50 struct sockaddr arp_ha; /* hardware address */
51 int arp_flags;/* flags */
52 };
53 /* arp_flags field values */
54 #define ATF_COM 0x02/* completed entry (arp_ha valid) */
55 #define ATF_PERM 0x04 /* permanent entry */
56 #define ATF_PUBL 0x08 /* publish (respond for other host) */
57 #define ATF_USETRAILERS 0x10 /* send trailer packets to host */
58
59 The address family for the arp_pa sockaddr must be AF_INET; for the
60 arp_ha sockaddr it must be AF_UNSPEC. The only flag bits which may be
61 written are ATF_PERM, ATF_PUBL and ATF_USETRAILERS. ATF_PERM causes
62 the entry to be permanent if the ioctl call succeeds. The peculiar
63 nature of the ARP tables may cause the ioctl to fail if more than 8
64 (permanent) Internet host addresses hash to the same slot. ATF_PUBL
65 specifies that the ARP code should respond to ARP requests for the
66 indicated host coming from other machines. This allows a host to act
67 as an ``ARP server,'' which may be useful in convincing an ARP-only
68 machine to talk to a non-ARP machine.
69
70 ARP is also used to negotiate the use of trailer IP encapsulations;
71 trailers are an alternate encapsulation used to allow efficient packet
72 alignment for large packets despite variable-sized headers. Hosts
73 which wish to receive trailer encapsulations so indicate by sending
74 gratuitous ARP translation replies along with replies to IP requests;
75 they are also sent in reply to IP translation replies. The negotiation
76 is thus fully symmetrical, in that either or both hosts may request
77 trailers. The ATF_USETRAILERS flag is used to record the receipt of
78 such a reply, and enables the transmission of trailer packets to that
79 host.
80
81 ARP watches passively for hosts impersonating the local host (i.e. a
82 host which responds to an ARP mapping request for the local host's
83 address).
84
86 duplicate IP address!! sent from ethernet address: %x:%x:%x:%x:%x:%x.
87 ARP has discovered another host on the local network which responds to
88 mapping requests for its own Internet address.
89
91 ec(4), de(4), il(4), inet(4F), arp(8C), ifconfig(8C)
92 ``An Ethernet Address Resolution Protocol,'' RFC826, Dave Plummer, Net‐
93 work Information Center, SRI.
94 ``Trailer Encapsulations,'' RFC893, S.J. Leffler and M.J. Karels, Net‐
95 work Information Center, SRI.
96
98 ARP packets on the Ethernet use only 42 bytes of data; however, the
99 smallest legal Ethernet packet is 60 bytes (not including CRC). Some
100 systems may not enforce the minimum packet size, others will.
101
102
103
1043rd Berkeley Distribution August 1, 1987 ARP(4P)