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>
        
@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Joyent, Inc.
  */
 
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/stream.h>
@@ -32,10 +33,11 @@
 #include <sys/zone.h>
 #include <sys/vnode.h>
 #include <sys/sysmacros.h>
 #define _SUN_TPI_VERSION 2
 #include <sys/tihdr.h>
+#include <sys/timod.h>
 #include <sys/ddi.h>
 #include <sys/sunddi.h>
 #include <sys/mkdev.h>
 #include <sys/debug.h>
 #include <sys/kmem.h>
@@ -3402,15 +3404,28 @@
                         /* Not supported by spdsock. */
                         spdsock_err_ack(q, mp, TNOTSUPPORT, 0);
                         break;
                 }
                 return;
+        case M_IOCDATA:
+                keysock_spdsock_wput_iocdata(q, mp, PF_POLICY);
+                return;
         case M_IOCTL:
                 iocp = (struct iocblk *)mp->b_rptr;
                 error = EINVAL;
 
                 switch (iocp->ioc_cmd) {
+                case TI_GETMYNAME:
+                case TI_GETPEERNAME:
+                        /*
+                         * For pfiles(1) observability with getsockname().
+                         * See keysock_spdsock_wput_iocdata() for the rest of
+                         * this.
+                         */
+                        mi_copyin(q, mp, NULL,
+                            SIZEOF_STRUCT(strbuf, iocp->ioc_flag));
+                        return;
                 case ND_SET:
                 case ND_GET:
                         if (nd_getset(q, spds->spds_g_nd, mp)) {
                                 qreply(q, mp);
                                 return;