arp.7p (2010 09)
a
arp(7P) arp(7P)
NAME
arp - Address Resolution Protocol
DESCRIPTION
ARP is a protocol used to dynamically map between
DARPA Internet and hardware station addresses. It is
used by all
LAN drivers.
ARP caches Internet-to-hardware station 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 mes-
sage on the associated network requesting the address mapping if the ether encapsulation method has
been enabled for the interface. If a response is provided, the new mapping is cached and any pending
message is transmitted.
ARP queues at most one packet while waiting for a mapping request to be
responded to; only the most recently ‘‘transmitted’’ packet is kept.
To facilitate communications with systems that do not use
ARP,
ioctl calls are provided to enter and
delete entries in the Internet-to-hardware station address tables.
Application Usage:
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/if_ether.h>
struct arpreq arpreq;
ioctl(s, SIOCSARP, (caddr_t)&arpreq);
ioctl(s, SIOCGARP, (caddr_t)&arpreq);
ioctl(s, SIOCDARP, (caddr_t)&arpreq);
Each ioctl call takes the same structure as an argument. SIOCSARP sets an ARP entry, SIOCGARP
gets an ARP entry, and SIOCDARP deletes an ARP entry. These ioctl calls can be applied to any
socket descriptor s, but only by the super-user. The arpreq structure contains:
/*
* ARP ioctl request
*/
struct arpreq {
int32_t ifindex;
int32_t arp_flags; /* flags */
int32_t arp_hw_addr_len; /* hardware address length */
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
u_char arp_pad[242]; /* buffer for link specific info. */
};
/* arp_flags field values */
#define ATF_COM 0x02 /* ARP on ether */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry */
#define ATF_SNAPFDDI 0x200 /* SNAP - FDDI */
#define ATF_SNAP8025 0x400 /* SNAP - 8025 */
#define ATF_IEEE8025 0x800 /* IEEE - 8025 */
#define ATF_FCSNAP 0x4000 /* Fibre Channel SNAP */
The address family for the arp_pa sockaddr must be AF_INET; for the arp_ha sockaddr it must be
AF_UNSPEC. The only flag bits that can be written are ATF_PERM, and ATF_PUBL. Fibre Channel
hosts only support the ATF_PERM flag. ATF_PERM causes the entry to be permanent. 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.
ARP watches passively for hosts impersonating the local host (i.e., a host that responds to an ARP map-
ping request for the local host’s address).
DIAGNOSTICS
duplicate IP address!! sent from ethernet address: %x:%x:%x:%x:%x:%x.
This message printed on the console screen means that ARP has discovered another host on the local
network that responds to mapping requests for its own Internet address.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1