NAME

  tst_rresvport_af - Creates an IPv6/TCP socket and binds a "reserved port" to the socket


PURPOSE

  To check rresvport_af() can use to create an IPv6/TCP socket and binds
  a "reserved port" to the socket.


SYNOPSIS

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


TEST PROCEDURE

  1. Creates an IPv6/TCP socket and binds a "reserved port" to the socket
  2. Check A: socket is created and port is a reserved port
  3. Creates an IPv4/TCP socket and binds a "reserved port" to the socket
  4. Check B: socket is created and port is a reserved port  
  5. Creates an AF_INET socket and binds a "reserved port" to the socket
  6. Check C: error EAFNOSUPPORT is returned


NOTE

  None


REFERENCE

  RFC 3542
  14.1.  rresvport_af
    The rresvport() function is used by the rcmd() function, and this
    function is in turn called by many of the "r" commands such as
    rlogin.  While new applications are not being written to use the
    rcmd() function, legacy applications such as rlogin will continue to
    use it and these will be ported to IPv6.
    rresvport() creates an IPv4/TCP socket and binds a "reserved port" to
    the socket.  Instead of defining an IPv6 version of this function we
    define a new function that takes an address family as its argument.
      #include <unistd.h>
      int  rresvport_af(int *port, int family);
    This function behaves the same as the existing rresvport() function,
    but instead of creating an AF_INET TCP socket, it can also create an
    AF_INET6 TCP socket.  The family argument is either AF_INET or
    AF_INET6, and a new error return is EAFNOSUPPORT if the address
    family is not supported.
    (Note: There is little consensus on which header defines the
    rresvport() and rcmd() function prototypes.  4.4BSD defines it in
    <unistd.h>, others in <netdb.h>, and others don't define the function
    prototypes at all.)