NAME

  tst_v6only_set_server - Allow two versions of the same server process to run on the same port


PURPOSE

  To check use of IPV6_V6ONLY option is to allow two versions of the
  same server process to run on the same port, one providing service
  over IPv6, the other providing the same service over IPv4.


SYNOPSIS

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


TEST PROCEDURE

  1. Create an IPv4 socket
  2. Bind the IPv4 socket to an port
  3. Listen on the IPv4 socket
  4. Create an IPv6 socket
  5. Disabled the IPV6_V6ONLY option of the IPv6 socket
  6. Bind the IPv6 socket to the same port
  7. Check A: IPv6 socket can not be bind to the same port
  8. Enabled the IPV6_V6ONLY option of the IPv6 socket
  9. Bind the IPv6 socket to the same port
  10.Check B: IPv6 socket can be bind to the same port, then
     two versions of the same server process to run on the
     same port
  11.Listen on the IPv6 socket


NOTE

  None


REFERENCE

  RFC 3493
  5.3 IPV6_V6ONLY option for AF_INET6 Sockets
    This socket option restricts AF_INET6 sockets to IPv6 communications
    only.  As stated in section <3.7 Compatibility with IPv4 Nodes>,
    AF_INET6 sockets may be used for both IPv4 and IPv6 communications.
    Some applications may want to restrict their use of an AF_INET6
    socket to IPv6 communications only.  For these applications the
    IPV6_V6ONLY socket option is defined.  When this option is turned on,
    the socket can be used to send and receive IPv6 packets only.  This
    is an IPPROTO_IPV6 level option.  This option takes an int value.
    This is a boolean option.  By default this option is turned off.
    Here is an example of setting this option:
      int on = 1;
      if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
                     (char *)&on, sizeof(on)) == -1)
          perror("setsockopt IPV6_V6ONLY");
      else
          printf("IPV6_V6ONLY set\n");
    Note - This option has no effect on the use of IPv4 Mapped addresses
    which enter a node as a valid IPv6 addresses for IPv6 communications
    as defined by Stateless IP/ICMP Translation Algorithm (SIIT) [5].
    An example use of this option is to allow two versions of the same
    server process to run on the same port, one providing service over
    IPv6, the other providing the same service over IPv4.