


ARP(4P)                     PROTOCOLS                     ARP(4P)



NAME
     arp - Address Resolution Protocol

CONFIG
     pseudo-device ether

SYNOPSIS
     #include <sys/socket.h>
     #include <net/if_arp.h>
     #include <netinet/in.h>

     s = socket(AF_INET, SOCK_DGRAM, 0);

DESCRIPTION
     ARP is a protocol used to dynamically map  between  Internet
     Protocol  (IP) and 10Mb/s Ethernet addresses.  It is used by
     all the  10Mb/s  Ethernet  interface  drivers.   It  is  not
     specific to the Internet Protocol or to the 10Mb/s Ethernet,
     but this implementation currently supports only that  combi-
     nation.

     ARP caches IP-to-Ethernet address mappings.  When an  inter-
     face 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;  only  the  most recently transmitted
     packet is kept.

     To facilitate communications with systems which do  not  use
     ARP,  ioctl()  requests  are  provided  to  enter and delete
     entries in the IP-to-Ethernet tables.

USAGE
          #include <sys/sockio.h>
          #include <sys/socket.h>
          #include <net/if.h>
          #include <net/if_arp.h>
          struct arpreq arpreq;
          ioctl(s, SIOCSARP, (caddr_t)&arpreq);
          ioctl(s, SIOCGARP, (caddr_t)&arpreq);
          ioctl(s, SIOCDARP, (caddr_t)&arpreq);

     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 ioctl()  requests  may
     be  applied  to  any  socket  descriptor  _s, but only by the
     super-user.  The arpreq structure contains:





Sun Release 4.1   Last change: 24 January 1990                  1






ARP(4P)                     PROTOCOLS                     ARP(4P)



          /*
           * 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          0x2  /* completed entry (arp_ha valid) */
          #define   ATF_PERM       0x4  /* permanent entry */
          #define   ATF_PUBL       0x8  /* publish (respond for other host) */
          #define   ATF_USETRAILERS          0x10 /* send trailer packets to host */

     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  which  may  be  written  are  ATF_PERM,  ATF_PUBL  and
     ATF_USETRAILERS.   ATF_PERM makes the entry permanent if the
     ioctl() call succeeds.   The  peculiar  nature  of  the  ARP
     tables  may  cause  the ioctl() to fail if more than 6 (per-
     manent) IP addresses hash to the same slot.  ATF_PUBL speci-
     fies  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 con-
     vincing an ARP-only machine to talk to a non-ARP machine.

     ARP is also used to negotiate the use of trailer IP encapsu-
     lations;  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  trans-
     lation  replies  along with replies to IP requests; they are
     also sent in reply to IP translation replies.  The  negotia-
     tion 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.

     ARP watches passively for hosts impersonating the local host
     (that  is,  a  host which responds to an ARP mapping request
     for the local host's address).

SEE ALSO
     ec(4S), ie(4S), inet(4F), arp(8C), ifconfig(8C)

     Plummer, Dave, ``_A_n  _E_t_h_e_r_n_e_t  _A_d_d_r_e_s_s  _R_e_s_o_l_u_t_i_o_n  _P_r_o_t_o_c_o_l
     -_o_r-  _C_o_n_v_e_r_t_i_n_g _N_e_t_w_o_r_k _P_r_o_t_o_c_o_l _A_d_d_r_e_s_s_e_s _t_o _4_8._b_i_t _E_t_h_e_r_-
     _n_e_t _A_d_d_r_e_s_s_e_s _f_o_r _T_r_a_n_s_m_i_s_s_i_o_n _o_n _E_t_h_e_r_n_e_t  _H_a_r_d_w_a_r_e,''  RFC
     826,  Network  Information  Center, SRI International, Menlo
     Park, Calif., November 1982. (Sun 800-1059-10)





Sun Release 4.1   Last change: 24 January 1990                  2






ARP(4P)                     PROTOCOLS                     ARP(4P)



     Leffler,  Sam,  and  Michael  Karels,  ``_T_r_a_i_l_e_r  _E_n_c_a_p_s_u_l_a_-
     _t_i_o_n_s,''  RFC  893, Network Information Center, SRI Interna-
     tional, Menlo Park, Calif., April 1984.

DIAGNOSTICS
%x:%x:%x:%x:%x:%x.
     duplicate   IP   address!!   sent    from    ethernet    address:
          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 use only 42 bytes of data,  how-
     ever,  the  smallest  legal Ethernet packet is 60 bytes (not
     including CRC). Some systems may  not  enforce  the  minimum
     packet size, others will.







































Sun Release 4.1   Last change: 24 January 1990                  3



