X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/c66bde989c72461b5ca17917a47f91441a3f3347..ed554bc5e4201344d7eaad78263566e79428759c:/usr/src/usr.sbin/arp/arp4.4 diff --git a/usr/src/usr.sbin/arp/arp4.4 b/usr/src/usr.sbin/arp/arp4.4 index ed270a79d9..0cd7161450 100644 --- a/usr/src/usr.sbin/arp/arp4.4 +++ b/usr/src/usr.sbin/arp/arp4.4 @@ -1,130 +1,124 @@ -.\" Copyright (c) 1985 The Regents of the University of California. -.\" All rights reserved. +.\" Copyright (c) 1985, 1986, 1988, 1994 +.\" The Regents of the University of California. All rights reserved. .\" -.\" Redistribution and use in source and binary forms are permitted -.\" provided that the above copyright notice and this paragraph are -.\" duplicated in all such forms and that any documentation, -.\" advertising materials, and other materials related to such -.\" distribution and use acknowledge that the software was developed -.\" by the University of California, Berkeley. The name of the -.\" University may not be used to endorse or promote products derived -.\" from this software without specific prior written permission. -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. .\" -.\" @(#)arp4.4 6.3 (Berkeley) %G% +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. .\" -.TH
"" -.TH ARP 4 "" -.UC 5 -.SH NAME -arp \- Address Resolution Protocol -.SH SYNOPSIS -.B "pseudo-device ether" -.SH DESCRIPTION -ARP is a protocol used to dynamically map between DARPA Internet -and 10Mb/s Ethernet addresses. It is -used by all the 10Mb/s Ethernet interface drivers. +.\" @(#)arp4.4 6.5 (Berkeley) 4/18/94 +.\" +.Dd April 18, 1994 +.Dt ARP 4 +.Os BSD 4 +.Sh NAME +.Nm arp +.Nd Address Resolution Protocol +.Sh SYNOPSIS +.Em "pseudo-device ether" +.Sh DESCRIPTION +The Address Resolution Protocol (ARP) is a protocol used to dynamically +map between Internet host addresses and 10Mb/s Ethernet addresses. +It is used by all the 10Mb/s Ethernet interface drivers. It is not specific to Internet protocols or to 10Mb/s Ethernet, but this implementation currently supports only that combination. -.PP -ARP caches Internet-Ethernet address mappings. When an interface -requests a mapping for an address not in the cache, ARP queues the -message which requires the mapping and broadcasts +.Pp +ARP caches Internet-Ethernet address mappings. +When an interface requests a mapping for an address not in the cache, +ARP queues the message which requires the mapping and broadcasts a message on the associated network requesting the address mapping. If a response is provided, the new mapping is cached and any pending message is transmitted. -ARP will queue -at most one packet while waiting for a mapping request to be responded to; +ARP will queue at most one packet while waiting for a response to a +mapping request; only the most recently ``transmitted'' packet is kept. -.PP -To facilitate communications with systems which do not use ARP, -.IR ioctl \^s -are provided to enter and delete entries in the Internet-to-Ethernet tables. -Usage: -.LP -.nf -.ft B - #include - #include - #include - struct arpreq arpreq; - - ioctl(s, SIOCSARP, (caddr_t)&arpreq); - ioctl(s, SIOCGARP, (caddr_t)&arpreq); - ioctl(s, SIOCDARP, (caddr_t)&arpreq); -.fi -.ft R -Each ioctl takes the same structure as an argument. -SIOCSARP sets an ARP entry, SIOCGARP gets an ARP entry, and SIOCDARP -deletes an ARP entry. These ioctls may be applied to any socket descriptor -.I s, -but only by the super-user. -The -.I arpreq -structure contains: -.LP -.RS -.ta \w'#define\ \ 'u +\w'ATF_USETRAILERS\ \ 'u +\w'0x08\ \ \ \ 'u -.nf -/* - * ARP ioctl request - */ -struct arpreq { - struct sockaddr arp_pa; /* protocol address */ - struct sockaddr arp_ha; /* hardware address */ - int arp_flags; /* flags */ -}; -/* arp_flags field values */ -#define ATF_COM 0x02 /* completed entry (arp_ha valid) */ -#define ATF_PERM 0x04 /* permanent entry */ -#define ATF_PUBL 0x08 /* publish (respond for other host) */ -#define ATF_USETRAILERS 0x10 /* send trailer packets to host */ -.fi -.RE -.LP -The address family for the -.I arp_pa -sockaddr must be AF_INET; for the -.I arp_ha -sockaddr it must be AF_UNSPEC. -The only flag bits which may be written are ATF_PERM, ATF_PUBL -and ATF_USETRAILERS. -ATF_PERM causes the entry to be permanent if the ioctl call succeeds. -The peculiar nature of the ARP tables may cause the ioctl to fail if more -than 8 (permanent) Internet host addresses hash to the same slot. -ATF_PUBL specifies that the ARP code should respond to ARP requests for the -indicated host coming from other machines. This allows a host to act as an -``ARP server,'' which may be useful in convincing an ARP-only machine to talk -to a non-ARP machine. -.PP -ARP is also used to negotiate the use of trailer IP encapsulations; -trailers are an alternate encapsulation used to allow efficient packet -alignment for large packets despite variable-sized headers. -Hosts which wish to receive trailer encapsulations so indicate -by sending gratuitous ARP translation replies along with replies -to IP requests; they are also sent in reply to IP translation replies. -The negotiation is thus fully symmetrical, in that either or both hosts -may request trailers. -The ATF_USETRAILERS flag is used to record the receipt of such a reply, -and enables the transmission of trailer packets to that host. -.PP +If the target host does not respond after several requests, +the host is considered to be down for a short period (normally 20 seconds), +allowing an error to be returned to transmission attempts during this +interval. +The error is +.Li EHOSTDOWN +for a non-responding destination host, and +.Li EHOSTUNREACH +for a non-responding router. +.Pp +The ARP cache is stored in the system routing table as +dynamically-created host routes. +The route to a directly-attached Ethernet network is installed as a +.Dq cloning +route (one with the +.Li RTF_CLONING +flag set), +causing routes to individual hosts on that network to be created on +demand. +These routes time out periodically (normally 20 minutes after validated; +entries are not validated when not in use). +An entry for a host which is not responding is a +.Dq reject +route (one with the +.Li RTF_REJECT +flag set). +.Pp +ARP entries may be added, deleted or changed with the +.Xr arp 8 +utility. +Manually-added entries may be temporary or permanent, +and may be +.Dq published , +in which case the system will respond to ARP requests for that host +as if it were the target of the request. +.Pp +In the past, +ARP was used to negotiate the use of a trailer encapsulation. +This is no longer supported. +.Pp ARP watches passively for hosts impersonating the local host (i.e. a host which responds to an ARP mapping request for the local host's address). -.SH DIAGNOSTICS -.B "duplicate IP address!! sent from ethernet address: %x:%x:%x:%x:%x:%x." +.Sh DIAGNOSTICS +.Em "duplicate IP address %x!! sent from ethernet address: %x:%x:%x:%x:%x:%x." ARP has discovered another host on the local network which responds to -mapping requests for its own Internet address. -.SH SEE ALSO -ec(4), de(4), il(4), inet(4), arp(8), ifconfig(8) -.br -``An Ethernet Address Resolution Protocol,'' RFC826, Dave Plummer, -Network Information Center, SRI. -.br -``Trailer Encapsulations,'' RFC893, S.J. Leffler and M.J. Karels, -Network Information Center, SRI. -.SH BUGS -ARP packets on the Ethernet use only 42 bytes of data; however, the smallest -legal Ethernet packet is 60 bytes (not including CRC). -Some systems may not enforce the minimum packet size, others will. +mapping requests for its own Internet address with a different Ethernet +address, generally indicating that two hosts are attempting to use the +same Internet address. +.Sh SEE ALSO +.Xr inet 4 , +.Xr route 4 , +.Xr arp 8 , +.Xr ifconfig 8 , +.Xr route 8 +.sp +.Rs +.%A Plummer, D. +.%B "An Ethernet Address Resolution Protocol" +.%T RFC826 +.Re +.Rs +.%A Leffler, S.J. +.%A Karels, M.J. +.%B "Trailer Encapsulations +.%T RFC893 +.Re +