Print this page
8541 pfiles does not properly identify PF_KEY or PF_POLICY
Reviewed by: Mike Zeller <mike.zeller@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/spdsock.c
          +++ new/usr/src/uts/common/inet/ip/spdsock.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 (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
       24 + * Copyright 2017 Joyent, Inc.
  24   25   */
  25   26  
  26   27  #include <sys/param.h>
  27   28  #include <sys/types.h>
  28   29  #include <sys/stream.h>
  29   30  #include <sys/strsubr.h>
  30   31  #include <sys/strsun.h>
  31   32  #include <sys/stropts.h>
  32   33  #include <sys/zone.h>
  33   34  #include <sys/vnode.h>
  34   35  #include <sys/sysmacros.h>
  35   36  #define _SUN_TPI_VERSION 2
  36   37  #include <sys/tihdr.h>
       38 +#include <sys/timod.h>
  37   39  #include <sys/ddi.h>
  38   40  #include <sys/sunddi.h>
  39   41  #include <sys/mkdev.h>
  40   42  #include <sys/debug.h>
  41   43  #include <sys/kmem.h>
  42   44  #include <sys/cmn_err.h>
  43   45  #include <sys/suntpi.h>
  44   46  #include <sys/policy.h>
  45   47  #include <sys/dls.h>
  46   48  
↓ open down ↓ 3350 lines elided ↑ open up ↑
3397 3399                          /* Illegal for spdsock. */
3398 3400                          freemsg(mp);
3399 3401                          (void) putnextctl1(RD(q), M_ERROR, EPROTO);
3400 3402                          break;
3401 3403                  default:
3402 3404                          /* Not supported by spdsock. */
3403 3405                          spdsock_err_ack(q, mp, TNOTSUPPORT, 0);
3404 3406                          break;
3405 3407                  }
3406 3408                  return;
     3409 +        case M_IOCDATA:
     3410 +                keysock_spdsock_wput_iocdata(q, mp, PF_POLICY);
     3411 +                return;
3407 3412          case M_IOCTL:
3408 3413                  iocp = (struct iocblk *)mp->b_rptr;
3409 3414                  error = EINVAL;
3410 3415  
3411 3416                  switch (iocp->ioc_cmd) {
     3417 +                case TI_GETMYNAME:
     3418 +                case TI_GETPEERNAME:
     3419 +                        /*
     3420 +                         * For pfiles(1) observability with getsockname().
     3421 +                         * See keysock_spdsock_wput_iocdata() for the rest of
     3422 +                         * this.
     3423 +                         */
     3424 +                        mi_copyin(q, mp, NULL,
     3425 +                            SIZEOF_STRUCT(strbuf, iocp->ioc_flag));
     3426 +                        return;
3412 3427                  case ND_SET:
3413 3428                  case ND_GET:
3414 3429                          if (nd_getset(q, spds->spds_g_nd, mp)) {
3415 3430                                  qreply(q, mp);
3416 3431                                  return;
3417 3432                          } else
3418 3433                                  error = ENOENT;
3419 3434                          /* FALLTHRU */
3420 3435                  default:
3421 3436                          miocnak(q, mp, 0, error);
↓ open down ↓ 329 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX