arp(7) CLIX arp(7)
NAME
arp - Address Resolution Protocol (ARP) STREAMS module
DESCRIPTION
The arp module is a STREAMS module that implements the Address Resolution
Protocol (ARP) (see ``An Ethernet Address Resolution Protocol,'' RFC826,
Dave Plummer, Network Information Center, SRI). ARP is a protocol used to
dynamically map between Defense Advanced Research Projects Agency (DARPA)
Internet addresses and Ethernet addresses. It is not specific to Internet
protocols or to Ethernet, but this implementation currently supports only
that combination.
The arp module must be inserted with the I_PUSH ioctl() onto a stream
terminated by an Ethernet device driver that conforms to the AT&T Logical
Link Interface specifications (such as /dev/et0). The Ethernet device
driver must be bound to the ARP Protocol (0x806). The incd daemon
performs this binding at boot time.
To facilitate communications with systems that do not access ARP directly,
STREAMS ioctl() requests are provided to add and delete entries in the
Internet-to-Ethernet address tables. Two formats for the STREAMS ioctl()
requests are supported; a local format as well as the standard Berkeley
format. These STREAMS ioctl() requests may be applied to any open file
descriptor referring to a STREAMS device that provides support for arp
ioctl() requests. Several devices that support these requests are
/dev/ip, /dev/udp, and /dev/tcp. The format of a STREAMS ioctl() request
is as follows:
#include <sys/stropts.h>
#include <sys/dod/ar.h>
#include <net/dod/arp.h>
struct strioctl ic;
ioctl (fd, I_STR, (caddr_t) &ic);
struct strioctl {
int ic_cmd; /* command */
int ic_timout; /* timeout value */
int ic_len; /* length of data */
char *ic_dp; /* pointer to data */
};
The ic_cmd member should be set to one of the following commands as
defined in <sys/dod/arp.h>:
I_ARPADD Add an ARP entry to the local cache.
I_ARPDEL Delete an ARP entry from the local cache.
2/94 - Intergraph Corporation 1
arp(7) CLIX arp(7)
I_ARPLOC Retrieve an ARP entry from the local cache.
I_ARPTRNS Retrieve an ARP entry by first looking in the local cache; if
a translation is not found in the local cache, the net is
queried for a translation.
I_ARPREQ Query the net for a translation.
I_ARPTBL Obtain all entries in the local ARP cache.
The ic_timout member should be set to zero for all commands listed above.
The timeout for network responses is set automatically to five seconds.
For I_ARPTBL, ic_len should reflect the size (in bytes) of the buffer
pointed by ic_dp. For the remainder of the commands, ic_len should be set
to ARP_IOC_SZ as defined in <sys/dod/arp.h>:
The entries in the ARP cache have the following format as defined in
<sys/dod/arp.h>:
struct arp_ioc {
unchar inet[INET_ALEN]; /* Internet address */
unchar enet[ENET_ALEN]; /* Ethernet address */
ushort flags; /* arp flags */
};
For I_ARPTBL, ic_dp should contain a pointer to a buffer large enough to
hold all entries in the arp cache. If the buffer is large enough to hold
all of the entries, the value returned by ioctl() will be zero.
Otherwise, the value returned will be the number of entries in the arp
cache. For the remainder of the commands listed above, ic_dp should be a
pointer to an arp_ioc structure. The addresses in inet and enet should be
stored in network byte order (most significant byte first) and are
returned in this format. For I_ARPADD, flags should be set to one of the
following values as defined in <sys/dod/ar.h>:
AR_LOCAL_FL
Translation for local interface.
AR_PERM_FL
Permanent entry.
AR_PUBL_FL
Reply to ARP requests from the network.
For I_ARPDEL, flags must be set to AR_PERM_FL in order to successfully
delete a permanent entry. For I_ARPLOC, I_ARPTRNS and I_ARPREQ, flags
should be set to one of the following values as defined in <sys/dod/ar.h>:
INET Retrieves the Ethernet address translation for the given inet
address.
2 Intergraph Corporation - 2/94
arp(7) CLIX arp(7)
ENET Retrieves the Internet address translation for the given enet
address.
In addition to the above STREAMS ioctl() requests, support is provided for
the following ioctl() requests to any socket() descriptor:
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
} arpreq;
ioctl(sd, cmd, &arpreq);
The following cmds are valid:
SIOCSARP Sets an ARP entry.
SIOCGARP Gets an ARP entry.
SIOCDARP Deletes an ARP entry.
SIOCXARP Queries the local network for an ARP entry.
The address format for arp_pa and arp_ha are described in inet(7). The
address family specified in arp_pa must be AF_INET and AF_UNSPEC in
arp_ha.
The flags parameter may be one of the following as defined in
<net/if_arp.h>:
ATF_COM Completed entry.
ATF_PERM Permanent entry.
The ATF_PERM entry is the only flag that can be written.
Only the superuser may add or delete entries in the ARP cache. If an arp
ioctl() fails, errno will be set to one of the following:
[EINVAL] A command other than I_ARPTBL was issued without a valid
pointer. in the ic_dp field.
[EPERM] The effective user ID is not superuser.
[EAGAIN] STREAMS resources are insufficient.
[EACCES] Permission to perform the requested action is denied.
[ENOENT] A translation was not found in the local ARP cache.
2/94 - Intergraph Corporation 3
arp(7) CLIX arp(7)
[ETIME] The timer for the arp request has expired.
FILES
<sys/dod/inet.h> Special device file for UDP.
<sys/dod/dod_ut.h> Internet address definitions.
<sys/dod/ar.h>
<sys/dod/arp.h>
NOTES
The incd command is normally executed at boot time to configure the
STREAMS drivers and modules that implement network protocols, including
arp.
RELATED INFORMATION
Commands: ioctl(2)
Files: inet(7)
4 Intergraph Corporation - 2/94