Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ arp(7) — Interactive 3.2r4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

arp(1M)

ifconfig(1M)

netd(1M)

ec(7)

inet(7)

ip(7)

llc(7)

wd(7)

arp(7)  —  

NAME

arp − Address Resolution Protocol

SYNOPSIS

#include <net/if_arp.h>
s = open("/dev/arp", O_RDWR);

DESCRIPTION

arp is a protocol used to dynamically map between 32-bit Internet addresses and 48-bit Ethernet addresses.  It is implemented as a multiplexing STREAMS driver and is linked between network layer drivers and link layer drivers by netd(1M). arp communicates with both upper and lower STREAMS modules through the USL Link Provider Interface.  It is not specific to Internet protocols or to 10 MB/s ­Ethernet, but this implementation currently supports only that ­combination. 

arp caches Internet-Ethernet address mappings.  When an interface requests a mapping for an address not in the cache, arp queues the message that 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; only the most recently “transmitted” packet is kept. 

arp has been extended to implement transparent subnet gateways by the “Proxy arp” or “arp hack” technique.  This interface is enabled through ifconfig(1M).

To facilitate communications with systems which do not use arp, ioctls are provided to enter and delete entries in the Internet-to-Ethernet tables. The structures used by these ioctls are defined in the include file <net/if_arp.h>.  The ioctls may be applied to any socket descriptor s, but arp table entries may be set only by the superuser.  Usage:

#include <sys/types.h>
#include <sys/sioctl.h>
#include <sys/socket.h>
#include <net/if_arp.h>
struct strioctl strioctl;
struct arpreq arpreq;
struct arpent arpent;
struct arptimtab arptimtab;
strioctl.ic_cmd = SIOCGARP;
strioctl.ic_timout = 0;
strioctl.ic_len = sizeof (struct arpreq);
strioctl.ic_dp = (char *) &arpreq;
ioctl (s, I_STR, (caddr_t)&strioctl);

The ioctls SIOCSARP, SIOCGARP, and SIOCDARP use the arpreq structure as an argument.  SIOCSARP sets an arp table entry, SIOCGARP gets an arp table entry, and SIOCDARP deletes an arp table entry.  The SIOCSARP ioctl may set the following flag bits:

#define ATF_PERM  0x04  /∗ permanent entry ∗/
#define ATF_PUBL  0x08  /∗ publish (respond for other host) ∗/

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 eight (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.  The address family for the arp_pa sockaddr must be AF_INET; for the arp_ha sockaddr it must be AF_UNSPEC. 

The SIOCGENT ioctl uses the arpent structure as an argument and gets an arp table entry by index from the kernel.  The return value in the arpent structure’s ae_index field is the number of entries in the arp table.  This is convenient for dumping an arp table of unknown length. 

The ioctls SIOCGTIM and SIOCSTIM use the arptimtab structure as an argument.  SIOCGTIM gets the arp timeout parameters, and SIOCSTIM sets the timeout parameters.  These parameters are:

int arpt_interval;/∗ interval between timer runs ∗/
int arpt_killcom;/∗ timeout to kill a complete entry ∗/
int arpt_killinc;/∗ timeout to kill an incomplete entry ∗/

arpt_interval is the amount of time that the arp timer sleeps between ­running.  The default value is 60 seconds.  arpt_killcom is the amount of time before the timer kills a table entry.  The default value is 20 minutes and the timer is reset to zero every time a packet is sent to or received from that host.  arpt_killinc is the amount of time before the timer kills a table entry for a host that never responded to an arp request.  The default value is 3 minutes. 

arp sends out a request for the local host’s address when it starts, and watches passively for hosts impersonating the local host, i.e., a host that responds to an arp mapping request for the local host’s address. 

Configuration

The space.c file provides a mechanism for changing operating parameters of the arp driver.  The number of upper and lower streams, timeout parameters, and arp table size can be changed. 

SEE ALSO

arp(1M), ifconfig(1M), netd(1M), ec(7), inet(7), ip(7), llc(7), wd(7).  “An Ethernet Address Resolution Protocol,” RFC826, Dave ­Plummer, Network Information Center, SRI.  “Using ARP to Implement Transparent Subnet Gateways,” RFC1027, Carl-Mitchell Smoot and John S. Quarterman, Texas Internet ­Consulting. 

DIAGNOSTICS

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. 

BUGS

arp packets on the Ethernet need only 42 bytes of data but are padded to the minimum required by the lower stream protocol layer.  The smallest legal Ethernet packet is 60 bytes (not including CRC). 

\*U  —  Version 1.0

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026