NAME

  tst_recv_ifindex_tcp - Receiving interface index (TCP socket)


PURPOSE

  To check that when the IPV6_RECVPKTINFO socket option is enabled, the
  received interface index is always returned as the ipi6_ifindex member
  of the in6_pktinfo structure


SYNOPSIS

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


TEST PROCEDURE

  1. Create tcp socket for tcp server
  2. Create tcp socket for tcp client
  3. Enable tcp client to receive interface index
  4. Bind tcp server socket to address
  5. Listen on tcp server socket
  6. Connect tcp client to tcp server
  7. Accept a connection on tcp server
  8. Send message from tcp server to tcp client
  9. Recv message from tcp server on tcp client
  10.Get the value of IPV6_PKTOPTIONS option of tcp client used getsockopt()
  11.Check A: Check whether packet information is returned
  12.Check B: The received value and length of interface index is correct
  13.Close the tcp client
  14.Create tcp socket for tcp client
  15.Bind tcp client to interface lo
  16.Enable tcp client to receive interface index
  17.Get the value of IPV6_PKTOPTIONS option of tcp client used getsockopt()
  18.Check C: Check whether packet information is returned
  19.Check D: The received value and length of interface index is correct


NOTE

  None


REFERENCE

  RFC 3542
  6.1.  Specifying/Receiving the Interface
    Interfaces on an IPv6 node are identified by a small positive
    integer, as described in Section 4 of [RFC-3493].  That document also
    describes a function to map an interface name to its interface index,
    a function to map an interface index to its interface name, and a
    function to return all the interface names and indexes.  Notice from
    this document that no interface is ever assigned an index of 0.
    When specifying the outgoing interface, if the ipi6_ifindex value is
    0, the kernel will choose the outgoing interface.
    The ordering among various options that can specify the outgoing
    interface, including IPV6_PKTINFO, is defined in Section 6.7.
    When the IPV6_RECVPKTINFO socket option is enabled, the received
    interface index is always returned as the ipi6_ifindex member of the
    in6_pktinfo structure.