NAME

  tst_filter_willpass - Used ICMP6_FILTER_WILLPASS to depending whether the specified message type is passed to the application


PURPOSE

  To check that ICMP6_FILTER_WILLPASS can be used to depending whether the
  specified message type is passed to the application.


SYNOPSIS

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


TEST PROCEDURE

  1. Specify the message type 8 be blocked
  2. Check status of message types used ICMP6_FILTER_WILLPASS()
  3. Check A: the message type 8 be blocked and the other message
     type is passed


NOTE

  None


REFERENCE

  RFC 3542
  3.2.  ICMPv6 Type Filtering
    ICMPv4 raw sockets receive most ICMPv4 messages received by the
    kernel.  (We say "most" and not "all" because Berkeley-derived
    kernels never pass echo requests, timestamp requests, or address mask
    requests to a raw socket.  Instead these three messages are processed
    entirely by the kernel.)  But ICMPv6 is a superset of ICMPv4, also
    including the functionality of IGMPv4 and ARPv4.  This means that an
    ICMPv6 raw socket can potentially receive many more messages than
    would be received with an ICMPv4 raw socket: ICMP messages similar to
    ICMPv4, along with neighbor solicitations, neighbor advertisements,
    and the three multicast listener discovery messages.
    Most applications using an ICMPv6 raw socket care about only a small
    subset of the ICMPv6 message types.  To transfer extraneous ICMPv6
    messages from the kernel to user can incur a significant overhead.
    Therefore this API includes a method of filtering ICMPv6 messages by
    the ICMPv6 type field.
    Each ICMPv6 raw socket has an associated filter whose datatype is
    defined as
      struct icmp6_filter;
    This structure, along with the macros and constants defined later in
    this section, are defined as a result of including the
    <netinet/icmp6.h>.
    The current filter is fetched and stored using getsockopt() and
    setsockopt() with a level of IPPROTO_ICMPV6 and an option name of
    ICMP6_FILTER.
    Six macros operate on an icmp6_filter structure:
      void ICMP6_FILTER_SETPASSALL (struct icmp6_filter *);
      void ICMP6_FILTER_SETBLOCKALL(struct icmp6_filter *);
      void ICMP6_FILTER_SETPASS ( int, struct icmp6_filter *);
      void ICMP6_FILTER_SETBLOCK( int, struct icmp6_filter *);
      int  ICMP6_FILTER_WILLPASS (int,
                                  const struct icmp6_filter *);
      int  ICMP6_FILTER_WILLBLOCK(int,
                                  const struct icmp6_filter *);
    The first argument to the last four macros (an integer) is an ICMPv6
    message type, between 0 and 255.  The pointer argument to all six
    macros is a pointer to a filter that is modified by the first four
    macros and is examined by the last two macros.
    The first two macros, SETPASSALL and SETBLOCKALL, let us specify that
    all ICMPv6 messages are passed to the application or that all ICMPv6
    messages are blocked from being passed to the application.
    The next two macros, SETPASS and SETBLOCK, let us specify that
    messages of a given ICMPv6 type should be passed to the application
    or not passed to the application (blocked).
    The final two macros, WILLPASS and WILLBLOCK, return true or false
    depending whether the specified message type is passed to the
    application or blocked from being passed to the application by the
    filter pointed to by the second argument.
    When an ICMPv6 raw socket is created, it will by default pass all
    ICMPv6 message types to the application.