Print this page
OS-5007 support SO_ATTACH_FILTER on ICMP sockets
Reviewed by: Cody Mello <melloc@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/icmp_opt_data.c
          +++ new/usr/src/uts/common/inet/ip/icmp_opt_data.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright 2016 Joyent, Inc.
  24   25   */
  25   26  
  26   27  #include <sys/types.h>
  27   28  #include <sys/stream.h>
  28   29  #define _SUN_TPI_VERSION 2
  29   30  #include <sys/tihdr.h>
  30   31  #include <sys/socket.h>
  31   32  #include <sys/xti_xtiopt.h>
  32   33  #include <sys/xti_inet.h>
  33   34  
  34   35  #include <netinet/in.h>
  35   36  #include <netinet/icmp6.h>
  36   37  #include <inet/common.h>
  37   38  #include <netinet/ip6.h>
  38   39  #include <inet/ip.h>
  39   40  
  40   41  #include <netinet/tcp.h>
  41   42  #include <netinet/ip_mroute.h>
  42   43  #include <inet/optcom.h>
  43   44  #include <inet/rawip_impl.h>
       45 +#include <net/bpf.h>
  44   46  
  45   47  /*
  46   48   * Table of all known options handled on a ICMP protocol stack.
  47   49   *
  48   50   * Note: This table contains options processed by both ICMP and IP levels
  49   51   *       and is the superset of options that can be performed on a ICMP over IP
  50   52   *       stack.
  51   53   */
  52   54  opdes_t icmp_opt_arr[] = {
  53   55  
↓ open down ↓ 25 lines elided ↑ open up ↑
  79   81          },
  80   82  { SO_MAC_EXEMPT, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
  81   83          0 },
  82   84  { SO_MAC_IMPLICIT, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
  83   85          0 },
  84   86  
  85   87  { SO_ALLZONES, SOL_SOCKET, OA_R, OA_RW, OP_CONFIG, 0, sizeof (int),
  86   88          0 },
  87   89  { SO_DOMAIN,    SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
  88   90  
       91 +{ SO_ATTACH_FILTER,     SOL_SOCKET, OA_W, OA_W, OP_NP, 0,
       92 +        sizeof (struct bpf_program), 0 },
       93 +{ SO_DETACH_FILTER,     SOL_SOCKET, OA_W, OA_W, OP_NP, 0, 0, 0 },
       94 +
  89   95  { IP_OPTIONS,   IPPROTO_IP, OA_RW, OA_RW, OP_NP,
  90   96          (OP_VARLEN|OP_NODEFAULT),
  91   97          IP_MAX_OPT_LENGTH + IP_ADDR_LEN, -1 /* not initialized */ },
  92   98  { T_IP_OPTIONS, IPPROTO_IP, OA_RW, OA_RW, OP_NP,
  93   99          (OP_VARLEN|OP_NODEFAULT),
  94  100          IP_MAX_OPT_LENGTH + IP_ADDR_LEN, -1 /* not initialized */ },
  95  101  
  96  102  { IP_HDRINCL,   IPPROTO_IP, OA_R,  OA_RW, OP_RAW, 0,
  97  103          sizeof (int), 0 },
  98  104  { IP_TOS,       IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
↓ open down ↓ 243 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX