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