bring up to release 5
[unix-history] / usr / src / usr.sbin / arp / arp4.4
index a8786b4..87691c2 100644 (file)
@@ -2,36 +2,94 @@
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
 .\" All rights reserved.  The Berkeley software License Agreement
 .\" specifies the terms and conditions for redistribution.
 .\"
-.\"    @(#)arp4.4      5.1 (Berkeley) %G%
+.\"    @(#)arp4.4      6.1 (Berkeley) %G%
 .\"
 .\"
-.TH ARP 4P "18 July 1983"
+.TH ARP 4P ""
 .UC 5
 .SH NAME
 arp \- Address Resolution Protocol
 .SH SYNOPSIS
 .UC 5
 .SH NAME
 arp \- Address Resolution Protocol
 .SH SYNOPSIS
-.B pseudo-device ether
+.B "pseudo-device ether"
 .SH DESCRIPTION
 ARP is a protocol used to dynamically map between DARPA Internet
 .SH DESCRIPTION
 ARP is a protocol used to dynamically map between DARPA Internet
-and 10Mb/s Ethernet addresses on a local area network.  It is
-used by all the 10Mb/s Ethernet interface drivers and is not
-directly accessible to users.
+and 10Mb/s Ethernet addresses.  It is
+used by all the 10Mb/s Ethernet interface drivers.
 .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
 .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
-messages are transmitted.  ARP itself is not Internet or Ethernet
-specific; this implementation, however, is.  ARP will queue
+messages are transmitted.
+ARP will queue
 at most one packet while waiting for a mapping request to be responded to;
 only the most recently ``transmitted'' packet is kept.
 .PP
 at most one packet while waiting for a mapping request to be responded to;
 only the most recently ``transmitted'' packet is kept.
 .PP
+To enable communications with systems which do not use ARP, ioctls
+are provided to enter and delete entries in the Internet-to-Ethernet tables.
+Usage:
+.LP
+.nf
+.ft B
+       #include <sys/ioctl.h>
+       #include <sys/socket.h>
+       #include <net/if.h>
+       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
+.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         2       /* completed entry (arp_ha valid) */
+       #define ATF_PERM        4       /* permanent entry */
+       #define ATF_PUBL        8       /* publish (respond for other host) */
+.fi
+.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 and ATF_PUBL.
+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 4 (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 watches passively for hosts impersonating the local host (i.e. a host
 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)
-and will, optionally, periodically probe a network looking for impostors.
+which responds to an ARP mapping request for the local host's address).
 .SH DIAGNOSTICS
 .SH DIAGNOSTICS
-.B "duplicate IP address!! sent from ethernet address: %x %x %x %x %x %x".
+.B "duplicate IP address!! 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
 ARP has discovered another host on the local network which responds to
 mapping requests for its own Internet address.
 .SH SEE ALSO
-ec(4), il(4)
+ec(4), de(4), il(4), inet(4F), arp(8C), ifconfig(8C)
+.br
+An Ethernet Address Resolution Protocol, RFC826, Dave Plummer, MIT.
+.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.