NAME

  tst_addr_and_pro_family - IPv6 Address Family and Protocol Family


PURPOSE

  Check if we have defined IPv6 Address Family and Protocol Family


SYNOPSIS

  ./tst_addr_and_pro_family [-tooloption ...]
    -tooloption : v6api tool option


TEST PROCEDURE

  1. Check if we have defined IPv6 Address Family name AF_INET6
  2. Check if we have defined IPv6 Address Family name PF_INET6
  3. Check if AF_INET6 equal to PF_INET6


NOTE

  None


REFERENCE

  RFC 3493
  3.3 Socket Address Structure for 4.3BSD-Based Systems
     In the socket interface, a different protocol-specific data structure
     is defined to carry the addresses for each protocol suite.  Each
     protocol-specific data structure is designed so it can be cast into a
     protocol-independent data structure -- the "sockaddr" structure.
     Each has a "family" field that overlays the "sa_family" of the
     sockaddr data structure.  This field identifies the type of the data
     structure.
     The sockaddr_in structure is the protocol-specific address data
     structure for IPv4.  It is used to pass addresses between
     applications and the system in the socket functions.  The following
     sockaddr_in6 structure holds IPv6 addresses and is defined as a
     result of including the <netinet/in.h> header:
       struct sockaddr_in6 {
           sa_family_t     sin6_family;    /* AF_INET6 */
           in_port_t       sin6_port;      /* transport layer port # */
           uint32_t        sin6_flowinfo;  /* IPv6 flow information */
           struct in6_addr sin6_addr;      /* IPv6 address */
           uint32_t        sin6_scope_id;  /* set of interfaces for a scope */
       };
     This structure is designed to be compatible with the sockaddr data
     structure used in the 4.3BSD release.
     The sin6_family field identifies this as a sockaddr_in6 structure.
     This field overlays the sa_family field when the buffer is cast to a
     sockaddr data structure.  The value of this field must be AF_INET6.
     The sin6_port field contains the 16-bit UDP or TCP port number.  This
     field is used in the same way as the sin_port field of the
     sockaddr_in structure.  The port number is stored in network byte
     order.
     The sin6_flowinfo field is a 32-bit field intended to contain flow-
     related information.  The exact way this field is mapped to or from a
     packet is not currently specified.  Until such time as its use is
     specified, applications should set this field to zero when
     constructing a sockaddr_in6, and ignore this field in a sockaddr_in6
     structure constructed by the system.
     The sin6_addr field is a single in6_addr structure (defined in the
     previous section).  This field holds one 128-bit IPv6 address.  The
     address is stored in network byte order.
     The ordering of elements in this structure is specifically designed
     so that when sin6_addr field is aligned on a 64-bit boundary, the
     start of the structure will also be aligned on a 64-bit boundary.
     This is done for optimum performance on 64-bit architectures.
     The sin6_scope_id field is a 32-bit integer that identifies a set of
     interfaces as appropriate for the scope [2] of the address carried in
     the sin6_addr field.  The mapping of sin6_scope_id to an interface or
     set of interfaces is left to implementation and future specifications
     on the subject of scoped addresses.
     Notice that the sockaddr_in6 structure will normally be larger than
     the generic sockaddr structure.  On many existing implementations the
     sizeof(struct sockaddr_in) equals sizeof(struct sockaddr), with both
     being 16 bytes.  Any existing code that makes this assumption needs
     to be examined carefully when converting to IPv6.