install correct aliases file
[unix-history] / usr / src / usr.sbin / arp / arp4.4
CommitLineData
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
22arp \- Address Resolution Protocol
23.SH SYNOPSIS
2bfcba9f 24.B "pseudo-device ether"
d3eca8d4
KM
25.SH DESCRIPTION
26ARP is a protocol used to dynamically map between DARPA Internet
2bfcba9f
KM
27and 10Mb/s Ethernet addresses. It is
28used by all the 10Mb/s Ethernet interface drivers.
e17e7b88
MK
29It is not specific to Internet protocols or to 10Mb/s Ethernet,
30but this implementation currently supports only that combination.
d3eca8d4
KM
31.PP
32ARP caches Internet-Ethernet address mappings. When an interface
33requests a mapping for an address not in the cache, ARP queues the
34message which requires the mapping and broadcasts
35a message on the associated network requesting the address mapping.
36If a response is provided, the new mapping is cached and any pending
e17e7b88 37message is transmitted.
2bfcba9f 38ARP will queue
d3eca8d4
KM
39at most one packet while waiting for a mapping request to be responded to;
40only the most recently ``transmitted'' packet is kept.
41.PP
e17e7b88
MK
42To facilitate communications with systems which do not use ARP,
43.IR ioctl \^s
2bfcba9f
KM
44are provided to enter and delete entries in the Internet-to-Ethernet tables.
45Usage:
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
59Each ioctl takes the same structure as an argument.
60SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP
61deletes an ARP entry. These ioctls may be applied to any socket descriptor
62.I s,
63but only by the super-user.
64The
65.I arpreq
66structure 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 */
74struct 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
87The address family for the
88.I arp_pa
89sockaddr must be AF_INET; for the
90.I arp_ha
91sockaddr it must be AF_UNSPEC.
e17e7b88
MK
92The only flag bits which may be written are ATF_PERM, ATF_PUBL
93and ATF_USETRAILERS.
2bfcba9f
KM
94ATF_PERM causes the entry to be permanent if the ioctl call succeeds.
95The peculiar nature of the ARP tables may cause the ioctl to fail if more
e17e7b88 96than 8 (permanent) Internet host addresses hash to the same slot.
2bfcba9f
KM
97ATF_PUBL specifies that the ARP code should respond to ARP requests for the
98indicated 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
100to a non-ARP machine.
101.PP
e17e7b88
MK
102ARP is also used to negotiate the use of trailer IP encapsulations;
103trailers are an alternate encapsulation used to allow efficient packet
104alignment for large packets despite variable-sized headers.
105Hosts which wish to receive trailer encapsulations so indicate
106by sending gratuitous ARP translation replies along with replies
107to IP requests; they are also sent in reply to IP translation replies.
108The negotiation is thus fully symmetrical, in that either or both hosts
109may request trailers.
110The ATF_USETRAILERS flag is used to record the receipt of such a reply,
111and enables the transmission of trailer packets to that host.
112.PP
d3eca8d4 113ARP watches passively for hosts impersonating the local host (i.e. a host
2bfcba9f 114which 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
117ARP has discovered another host on the local network which responds to
118mapping requests for its own Internet address.
119.SH SEE ALSO
54b3b5b7 120ec(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,
123Network Information Center, SRI.
124.br
125``Trailer Encapsulations,'' RFC893, S.J. Leffler and M.J. Karels,
126Network Information Center, SRI.
2bfcba9f 127.SH BUGS
e17e7b88 128ARP packets on the Ethernet use only 42 bytes of data; however, the smallest
2bfcba9f
KM
129legal Ethernet packet is 60 bytes (not including CRC).
130Some systems may not enforce the minimum packet size, others will.