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