bring up to release 5
[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.\"
2bfcba9f 5.\" @(#)arp4.4 6.1 (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.
d3eca8d4
KM
17.PP
18ARP caches Internet-Ethernet address mappings. When an interface
19requests a mapping for an address not in the cache, ARP queues the
20message which requires the mapping and broadcasts
21a message on the associated network requesting the address mapping.
22If a response is provided, the new mapping is cached and any pending
2bfcba9f
KM
23messages are transmitted.
24ARP will queue
d3eca8d4
KM
25at most one packet while waiting for a mapping request to be responded to;
26only the most recently ``transmitted'' packet is kept.
27.PP
2bfcba9f
KM
28To enable communications with systems which do not use ARP, ioctls
29are provided to enter and delete entries in the Internet-to-Ethernet tables.
30Usage:
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
44Each ioctl takes the same structure as an argument.
45SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP
46deletes an ARP entry. These ioctls may be applied to any socket descriptor
47.I s,
48but only by the super-user.
49The
50.I arpreq
51structure 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
68The address family for the
69.I arp_pa
70sockaddr must be AF_INET; for the
71.I arp_ha
72sockaddr it must be AF_UNSPEC.
73The only flag bits which may be written are ATF_PERM and ATF_PUBL.
74ATF_PERM causes the entry to be permanent if the ioctl call succeeds.
75The peculiar nature of the ARP tables may cause the ioctl to fail if more
76than 4 (permanent) Internet host addresses hash to the same slot.
77ATF_PUBL specifies that the ARP code should respond to ARP requests for the
78indicated 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
80to a non-ARP machine.
81.PP
d3eca8d4 82ARP watches passively for hosts impersonating the local host (i.e. a host
2bfcba9f 83which 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
86ARP has discovered another host on the local network which responds to
87mapping requests for its own Internet address.
88.SH SEE ALSO
2bfcba9f
KM
89ec(4), de(4), il(4), inet(4F), arp(8C), ifconfig(8C)
90.br
91An Ethernet Address Resolution Protocol, RFC826, Dave Plummer, MIT.
92.SH BUGS
93ARP packets on the Ethernet use only 42 bytes of data, however, the smallest
94legal Ethernet packet is 60 bytes (not including CRC).
95Some systems may not enforce the minimum packet size, others will.