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 | .\" | |
2bfcba9f | 5 | .\" @(#)arp4.4 6.1 (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. | |
d3eca8d4 KM |
17 | .PP |
18 | ARP caches Internet-Ethernet address mappings. When an interface | |
19 | requests a mapping for an address not in the cache, ARP queues the | |
20 | message which requires the mapping and broadcasts | |
21 | a message on the associated network requesting the address mapping. | |
22 | If a response is provided, the new mapping is cached and any pending | |
2bfcba9f KM |
23 | messages are transmitted. |
24 | ARP will queue | |
d3eca8d4 KM |
25 | at most one packet while waiting for a mapping request to be responded to; |
26 | only the most recently ``transmitted'' packet is kept. | |
27 | .PP | |
2bfcba9f KM |
28 | To enable communications with systems which do not use ARP, ioctls |
29 | are provided to enter and delete entries in the Internet-to-Ethernet tables. | |
30 | Usage: | |
31 | .LP | |
32 | .nf | |
33 | .ft B | |
34 | #include <sys/ioctl.h> | |
35 | #include <sys/socket.h> | |
36 | #include <net/if.h> | |
37 | struct arpreq arpreq; | |
38 | ||
39 | ioctl(s, SIOCSARP, (caddr_t)&arpreq); | |
40 | ioctl(s, SIOCGARP, (caddr_t)&arpreq); | |
41 | ioctl(s, SIOCDARP, (caddr_t)&arpreq); | |
42 | .fi | |
43 | .ft R | |
44 | Each ioctl takes the same structure as an argument. | |
45 | SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP | |
46 | deletes an ARP entry. These ioctls may be applied to any socket descriptor | |
47 | .I s, | |
48 | but only by the super-user. | |
49 | The | |
50 | .I arpreq | |
51 | structure contains: | |
52 | .LP | |
53 | .nf | |
54 | /* | |
55 | * ARP ioctl request | |
56 | */ | |
57 | struct arpreq { | |
58 | struct sockaddr arp_pa; /* protocol address */ | |
59 | struct sockaddr arp_ha; /* hardware address */ | |
60 | int arp_flags; /* flags */ | |
61 | }; | |
62 | /* arp_flags field values */ | |
63 | #define ATF_COM 2 /* completed entry (arp_ha valid) */ | |
64 | #define ATF_PERM 4 /* permanent entry */ | |
65 | #define ATF_PUBL 8 /* publish (respond for other host) */ | |
66 | .fi | |
67 | .LP | |
68 | The address family for the | |
69 | .I arp_pa | |
70 | sockaddr must be AF_INET; for the | |
71 | .I arp_ha | |
72 | sockaddr it must be AF_UNSPEC. | |
73 | The only flag bits which may be written are ATF_PERM and ATF_PUBL. | |
74 | ATF_PERM causes the entry to be permanent if the ioctl call succeeds. | |
75 | The peculiar nature of the ARP tables may cause the ioctl to fail if more | |
76 | than 4 (permanent) Internet host addresses hash to the same slot. | |
77 | ATF_PUBL specifies that the ARP code should respond to ARP requests for the | |
78 | indicated host coming from other machines. This allows a host to act as an | |
79 | "ARP server" which may be useful in convincing an ARP-only machine to talk | |
80 | to a non-ARP machine. | |
81 | .PP | |
d3eca8d4 | 82 | ARP watches passively for hosts impersonating the local host (i.e. a host |
2bfcba9f | 83 | which responds to an ARP mapping request for the local host's address). |
d3eca8d4 | 84 | .SH DIAGNOSTICS |
2bfcba9f | 85 | .B "duplicate IP address!! sent from ethernet address: %x:%x:%x:%x:%x:%x." |
d3eca8d4 KM |
86 | ARP has discovered another host on the local network which responds to |
87 | mapping requests for its own Internet address. | |
88 | .SH SEE ALSO | |
2bfcba9f KM |
89 | ec(4), de(4), il(4), inet(4F), arp(8C), ifconfig(8C) |
90 | .br | |
91 | An Ethernet Address Resolution Protocol, RFC826, Dave Plummer, MIT. | |
92 | .SH BUGS | |
93 | ARP packets on the Ethernet use only 42 bytes of data, however, the smallest | |
94 | legal Ethernet packet is 60 bytes (not including CRC). | |
95 | Some systems may not enforce the minimum packet size, others will. |