NAME

  tst_recv_ifindex - Receive interface index when the IPV6_RECVPKTINFO socket option is enabled


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 [-tooloption ...]
    -tooloption : v6api tool option


TEST PROCEDURE

  1. Create an IPv6/UDP socket
  2. Enable the socket to receive interface index
  3. Bind the socket to address
  4. Send one message to itself
  5. Receive one message used recvmsg()
  6. Check A: Check whether packet information is returned
  7. Check B: 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.