|
|
1.1 root 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: .\"
5: .\" @(#)arp.4p 6.2 (Berkeley) 5/15/86
6: .\"
7: .TH ARP 4P "May 15, 1986"
8: .UC 5
9: .SH NAME
10: arp \- Address Resolution Protocol
11: .SH SYNOPSIS
12: .B "pseudo-device ether"
13: .SH DESCRIPTION
14: ARP is a protocol used to dynamically map between DARPA Internet
15: and 10Mb/s Ethernet addresses. It is
16: used by all the 10Mb/s Ethernet interface drivers.
17: It is not specific to Internet protocols or to 10Mb/s Ethernet,
18: but this implementation currently supports only that combination.
19: .PP
20: ARP caches Internet-Ethernet address mappings. When an interface
21: requests a mapping for an address not in the cache, ARP queues the
22: message which requires the mapping and broadcasts
23: a message on the associated network requesting the address mapping.
24: If a response is provided, the new mapping is cached and any pending
25: message is transmitted.
26: ARP will queue
27: at most one packet while waiting for a mapping request to be responded to;
28: only the most recently ``transmitted'' packet is kept.
29: .PP
30: To facilitate communications with systems which do not use ARP,
31: .IR ioctl \^s
32: are provided to enter and delete entries in the Internet-to-Ethernet tables.
33: Usage:
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
47: Each ioctl takes the same structure as an argument.
48: SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP
49: deletes an ARP entry. These ioctls may be applied to any socket descriptor
50: .I s,
51: but only by the super-user.
52: The
53: .I arpreq
54: structure contains:
55: .LP
56: .RS
57: .ta \w'#define\ \ 'u +\w'ATF_USETRAILERS\ \ 'u +\w'0x08\ \ \ \ 'u
58: .nf
59: /*
60: * ARP ioctl request
61: */
62: struct 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 */
72: .fi
73: .RE
74: .LP
75: The address family for the
76: .I arp_pa
77: sockaddr must be AF_INET; for the
78: .I arp_ha
79: sockaddr it must be AF_UNSPEC.
80: The only flag bits which may be written are ATF_PERM, ATF_PUBL
81: and ATF_USETRAILERS.
82: ATF_PERM causes the entry to be permanent if the ioctl call succeeds.
83: The peculiar nature of the ARP tables may cause the ioctl to fail if more
84: than 8 (permanent) Internet host addresses hash to the same slot.
85: ATF_PUBL specifies that the ARP code should respond to ARP requests for the
86: indicated host coming from other machines. This allows a host to act as an
87: ``ARP server,'' which may be useful in convincing an ARP-only machine to talk
88: to a non-ARP machine.
89: .PP
90: ARP is also used to negotiate the use of trailer IP encapsulations;
91: trailers are an alternate encapsulation used to allow efficient packet
92: alignment for large packets despite variable-sized headers.
93: Hosts which wish to receive trailer encapsulations so indicate
94: by sending gratuitous ARP translation replies along with replies
95: to IP requests; they are also sent in reply to IP translation replies.
96: The negotiation is thus fully symmetrical, in that either or both hosts
97: may request trailers.
98: The ATF_USETRAILERS flag is used to record the receipt of such a reply,
99: and enables the transmission of trailer packets to that host.
100: .PP
101: ARP watches passively for hosts impersonating the local host (i.e. a host
102: which responds to an ARP mapping request for the local host's address).
103: .SH DIAGNOSTICS
104: .B "duplicate IP address!! sent from ethernet address: %x:%x:%x:%x:%x:%x."
105: ARP has discovered another host on the local network which responds to
106: mapping requests for its own Internet address.
107: .SH SEE ALSO
108: ec(4), de(4), il(4), inet(4F), arp(8C), ifconfig(8C)
109: .br
110: ``An Ethernet Address Resolution Protocol,'' RFC826, Dave Plummer,
111: Network Information Center, SRI.
112: .br
113: ``Trailer Encapsulations,'' RFC893, S.J. Leffler and M.J. Karels,
114: Network Information Center, SRI.
115: .SH BUGS
116: ARP packets on the Ethernet use only 42 bytes of data; however, the smallest
117: legal Ethernet packet is 60 bytes (not including CRC).
118: Some systems may not enforce the minimum packet size, others will.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.