date and time created 87/01/28 15:36:08 by mckusick
[unix-history] / usr / src / usr.sbin / arp / arp4.4
CommitLineData
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
10arp \- Address Resolution Protocol
11.SH SYNOPSIS
2bfcba9f 12.B "pseudo-device ether"
d3eca8d4
KM
13.SH DESCRIPTION
14ARP is a protocol used to dynamically map between DARPA Internet
2bfcba9f
KM
15and 10Mb/s Ethernet addresses. It is
16used by all the 10Mb/s Ethernet interface drivers.
e17e7b88
MK
17It is not specific to Internet protocols or to 10Mb/s Ethernet,
18but this implementation currently supports only that combination.
d3eca8d4
KM
19.PP
20ARP caches Internet-Ethernet address mappings. When an interface
21requests a mapping for an address not in the cache, ARP queues the
22message which requires the mapping and broadcasts
23a message on the associated network requesting the address mapping.
24If a response is provided, the new mapping is cached and any pending
e17e7b88 25message is transmitted.
2bfcba9f 26ARP will queue
d3eca8d4
KM
27at most one packet while waiting for a mapping request to be responded to;
28only the most recently ``transmitted'' packet is kept.
29.PP
e17e7b88
MK
30To facilitate communications with systems which do not use ARP,
31.IR ioctl \^s
2bfcba9f
KM
32are provided to enter and delete entries in the Internet-to-Ethernet tables.
33Usage:
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
47Each ioctl takes the same structure as an argument.
48SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP
49deletes an ARP entry. These ioctls may be applied to any socket descriptor
50.I s,
51but only by the super-user.
52The
53.I arpreq
54structure 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 */
62struct 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
75The address family for the
76.I arp_pa
77sockaddr must be AF_INET; for the
78.I arp_ha
79sockaddr it must be AF_UNSPEC.
e17e7b88
MK
80The only flag bits which may be written are ATF_PERM, ATF_PUBL
81and ATF_USETRAILERS.
2bfcba9f
KM
82ATF_PERM causes the entry to be permanent if the ioctl call succeeds.
83The peculiar nature of the ARP tables may cause the ioctl to fail if more
e17e7b88 84than 8 (permanent) Internet host addresses hash to the same slot.
2bfcba9f
KM
85ATF_PUBL specifies that the ARP code should respond to ARP requests for the
86indicated 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
88to a non-ARP machine.
89.PP
e17e7b88
MK
90ARP is also used to negotiate the use of trailer IP encapsulations;
91trailers are an alternate encapsulation used to allow efficient packet
92alignment for large packets despite variable-sized headers.
93Hosts which wish to receive trailer encapsulations so indicate
94by sending gratuitous ARP translation replies along with replies
95to IP requests; they are also sent in reply to IP translation replies.
96The negotiation is thus fully symmetrical, in that either or both hosts
97may request trailers.
98The ATF_USETRAILERS flag is used to record the receipt of such a reply,
99and enables the transmission of trailer packets to that host.
100.PP
d3eca8d4 101ARP watches passively for hosts impersonating the local host (i.e. a host
2bfcba9f 102which 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
105ARP has discovered another host on the local network which responds to
106mapping requests for its own Internet address.
107.SH SEE ALSO
2bfcba9f
KM
108ec(4), de(4), il(4), inet(4F), arp(8C), ifconfig(8C)
109.br
e17e7b88
MK
110``An Ethernet Address Resolution Protocol,'' RFC826, Dave Plummer,
111Network Information Center, SRI.
112.br
113``Trailer Encapsulations,'' RFC893, S.J. Leffler and M.J. Karels,
114Network Information Center, SRI.
2bfcba9f 115.SH BUGS
e17e7b88 116ARP packets on the Ethernet use only 42 bytes of data; however, the smallest
2bfcba9f
KM
117legal Ethernet packet is 60 bytes (not including CRC).
118Some systems may not enforce the minimum packet size, others will.