193bc28dbSGordon Ross /* 293bc28dbSGordon Ross * CDDL HEADER START 393bc28dbSGordon Ross * 493bc28dbSGordon Ross * The contents of this file are subject to the terms of the 593bc28dbSGordon Ross * Common Development and Distribution License (the "License"). 693bc28dbSGordon Ross * You may not use this file except in compliance with the License. 793bc28dbSGordon Ross * 893bc28dbSGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 993bc28dbSGordon Ross * or http://www.opensolaris.org/os/licensing. 1093bc28dbSGordon Ross * See the License for the specific language governing permissions 1193bc28dbSGordon Ross * and limitations under the License. 1293bc28dbSGordon Ross * 1393bc28dbSGordon Ross * When distributing Covered Code, include this CDDL HEADER in each 1493bc28dbSGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1593bc28dbSGordon Ross * If applicable, add the following below this CDDL HEADER, with the 1693bc28dbSGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying 1793bc28dbSGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner] 1893bc28dbSGordon Ross * 1993bc28dbSGordon Ross * CDDL HEADER END 2093bc28dbSGordon Ross */ 2193bc28dbSGordon Ross 2293bc28dbSGordon Ross /* 2393bc28dbSGordon Ross * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2493bc28dbSGordon Ross * Use is subject to license terms. 2593bc28dbSGordon Ross * 260dfe541eSEvan Layton * Copyright 2018 Nexenta Systems, Inc. All rights reserved. 27*a5a9a6bbSGordon Ross * Copyright 2022 RackTop Systems, Inc. 2893bc28dbSGordon Ross */ 2993bc28dbSGordon Ross 3093bc28dbSGordon Ross #pragma D depends_on library ip.d 3193bc28dbSGordon Ross #pragma D depends_on library net.d 3293bc28dbSGordon Ross #pragma D depends_on module genunix 3393bc28dbSGordon Ross #pragma D depends_on module smbsrv 3493bc28dbSGordon Ross 3593bc28dbSGordon Ross #pragma D binding "1.5" translator 3693bc28dbSGordon Ross translator conninfo_t < struct smb_request *P > { 3793bc28dbSGordon Ross ci_protocol = 3893bc28dbSGordon Ross P->session->ipaddr.a_family == AF_INET6 ? "tcp6" : 3993bc28dbSGordon Ross P->session->ipaddr.a_family == AF_INET ? "tcp" : 4093bc28dbSGordon Ross "<unknown>"; 4193bc28dbSGordon Ross ci_local = "<any>"; /* not interesting */ 4293bc28dbSGordon Ross ci_remote = P->session->ip_addr_str; 4393bc28dbSGordon Ross }; 4493bc28dbSGordon Ross 4593bc28dbSGordon Ross /* 4693bc28dbSGordon Ross * The smbopinfo_t structure describes the internal form of a 4793bc28dbSGordon Ross * single SMB request (SMB v1). 4893bc28dbSGordon Ross */ 4993bc28dbSGordon Ross typedef struct smbopinfo { 5093bc28dbSGordon Ross cred_t *soi_cred; /* credentials for operation */ 5193bc28dbSGordon Ross string soi_share; /* share name */ 5293bc28dbSGordon Ross string soi_curpath; /* file handle path (if any) */ 5393bc28dbSGordon Ross uint64_t soi_sid; /* session id */ 5493bc28dbSGordon Ross uint32_t soi_pid; /* process id */ 5593bc28dbSGordon Ross uint32_t soi_status; /* status */ 5693bc28dbSGordon Ross uint16_t soi_tid; /* tree id */ 5793bc28dbSGordon Ross uint16_t soi_uid; /* user id */ 5893bc28dbSGordon Ross uint16_t soi_mid; /* request id */ 5993bc28dbSGordon Ross uint16_t soi_fid; /* file id */ 6093bc28dbSGordon Ross uint16_t soi_flags2; /* flags2 */ 6193bc28dbSGordon Ross uint8_t soi_flags; /* flags */ 620dfe541eSEvan Layton zoneid_t soi_zoneid; /* zone identifier */ 6393bc28dbSGordon Ross } smbopinfo_t; 6493bc28dbSGordon Ross 6593bc28dbSGordon Ross #pragma D binding "1.5" translator 6693bc28dbSGordon Ross translator smbopinfo_t < struct smb_request *P > { 6793bc28dbSGordon Ross soi_cred = (cred_t *)P->user_cr; 6893bc28dbSGordon Ross soi_sid = P->session->s_kid; 6993bc28dbSGordon Ross soi_pid = P->smb_pid; 7093bc28dbSGordon Ross soi_status = P->smb_error.status; 7193bc28dbSGordon Ross soi_tid = P->smb_tid; 7293bc28dbSGordon Ross soi_uid = P->smb_uid; 7393bc28dbSGordon Ross soi_mid = P->smb_mid; 7493bc28dbSGordon Ross soi_fid = P->smb_fid; 7593bc28dbSGordon Ross soi_flags2 = P->smb_flg2; 7693bc28dbSGordon Ross soi_flags = P->smb_flg; 770dfe541eSEvan Layton soi_zoneid = P->sr_server->sv_zid; 7893bc28dbSGordon Ross 7993bc28dbSGordon Ross soi_share = (P->tid_tree == NULL) ? "<NULL>" : 8093bc28dbSGordon Ross P->tid_tree->t_sharename; 8193bc28dbSGordon Ross 8293bc28dbSGordon Ross soi_curpath = (P->fid_ofile == NULL || 8393bc28dbSGordon Ross P->fid_ofile->f_node == NULL || 8493bc28dbSGordon Ross P->fid_ofile->f_node->vp == NULL || 8593bc28dbSGordon Ross P->fid_ofile->f_node->vp->v_path == NULL) ? "<NULL>" : 8693bc28dbSGordon Ross P->fid_ofile->f_node->vp->v_path; 8793bc28dbSGordon Ross }; 8893bc28dbSGordon Ross 8993bc28dbSGordon Ross typedef struct smb_rw_args { 9093bc28dbSGordon Ross off_t soa_offset; 9193bc28dbSGordon Ross uint_t soa_count; 9293bc28dbSGordon Ross } smb_rw_args_t; 9393bc28dbSGordon Ross 9493bc28dbSGordon Ross #pragma D binding "1.5" translator 9593bc28dbSGordon Ross translator smb_rw_args_t < smb_request_t *P > { 9693bc28dbSGordon Ross soa_offset = P->arg.rw->rw_offset; 9793bc28dbSGordon Ross soa_count = P->arg.rw->rw_count; 9893bc28dbSGordon Ross }; 9993bc28dbSGordon Ross 10093bc28dbSGordon Ross typedef struct smb_name_args { 10193bc28dbSGordon Ross string soa_name; 10293bc28dbSGordon Ross } smb_name_args_t; 10393bc28dbSGordon Ross 10493bc28dbSGordon Ross #pragma D binding "1.5" translator 10593bc28dbSGordon Ross translator smb_name_args_t < smb_request_t *P > { 10693bc28dbSGordon Ross soa_name = (P->arg.dirop.fqi.fq_path.pn_path == NULL) ? "<NULL>" : 10793bc28dbSGordon Ross P->arg.dirop.fqi.fq_path.pn_path; 10893bc28dbSGordon Ross }; 10993bc28dbSGordon Ross 11093bc28dbSGordon Ross typedef struct smb_open_args { 11193bc28dbSGordon Ross string soa_name; 11293bc28dbSGordon Ross uint32_t soa_desired_access; 11393bc28dbSGordon Ross uint32_t soa_share_access; 11493bc28dbSGordon Ross uint32_t soa_create_options; 11593bc28dbSGordon Ross uint32_t soa_create_disposition; 11693bc28dbSGordon Ross } smb_open_args_t; 11793bc28dbSGordon Ross 11893bc28dbSGordon Ross #pragma D binding "1.5" translator 11993bc28dbSGordon Ross translator smb_open_args_t < smb_request_t *P > { 12093bc28dbSGordon Ross soa_name = (P->arg.open.fqi.fq_path.pn_path == NULL) ? "<NULL>" : 12193bc28dbSGordon Ross P->arg.open.fqi.fq_path.pn_path; 12293bc28dbSGordon Ross soa_desired_access = P->arg.open.desired_access; 12393bc28dbSGordon Ross soa_share_access = P->arg.open.share_access; 12493bc28dbSGordon Ross soa_create_options = P->arg.open.create_options; 12593bc28dbSGordon Ross soa_create_disposition = P->arg.open.create_disposition; 12693bc28dbSGordon Ross }; 12793bc28dbSGordon Ross 12893bc28dbSGordon Ross /* 12993bc28dbSGordon Ross * The smb2opinfo_t structure describes the internal form of a 13093bc28dbSGordon Ross * single SMB2 request (SMB v2 and later). 13193bc28dbSGordon Ross */ 13293bc28dbSGordon Ross typedef struct smb2opinfo { 13393bc28dbSGordon Ross cred_t *soi_cred; /* credentials for operation */ 13493bc28dbSGordon Ross string soi_share; /* share name */ 13593bc28dbSGordon Ross string soi_curpath; /* file handle path (if any) */ 13693bc28dbSGordon Ross uint64_t soi_sid; /* (internal) session ID */ 13793bc28dbSGordon Ross uint64_t soi_mid; /* Message ID */ 13893bc28dbSGordon Ross uint64_t soi_asyncid; /* Message ID (when async) */ 13993bc28dbSGordon Ross uint64_t soi_uid; /* user ID (SMB2 Session ID) */ 14093bc28dbSGordon Ross uint32_t soi_tid; /* tree ID */ 141*a5a9a6bbSGordon Ross uint32_t soi_fid; /* file ID */ 14293bc28dbSGordon Ross uint32_t soi_status; 14393bc28dbSGordon Ross uint32_t soi_flags; 1440dfe541eSEvan Layton zoneid_t soi_zoneid; /* zone identifier */ 14593bc28dbSGordon Ross } smb2opinfo_t; 14693bc28dbSGordon Ross 14793bc28dbSGordon Ross #pragma D binding "1.5" translator 14893bc28dbSGordon Ross translator smb2opinfo_t < struct smb_request *P > { 14993bc28dbSGordon Ross soi_cred = (cred_t *)P->user_cr; 15093bc28dbSGordon Ross soi_sid = P->session->s_kid; 15193bc28dbSGordon Ross soi_mid = P->smb2_messageid; 15293bc28dbSGordon Ross soi_asyncid = P->smb2_async_id; 153811599a4SMatt Barden soi_uid = P->smb2_ssnid; 15493bc28dbSGordon Ross soi_tid = P->smb_tid; 155*a5a9a6bbSGordon Ross soi_fid = P->smb_fid; 15693bc28dbSGordon Ross soi_status = P->smb2_status; 15793bc28dbSGordon Ross soi_flags = P->smb2_hdr_flags; 1580dfe541eSEvan Layton soi_zoneid = P->sr_server->sv_zid; 15993bc28dbSGordon Ross 16093bc28dbSGordon Ross soi_share = (P->tid_tree == NULL) ? "<NULL>" : 16193bc28dbSGordon Ross P->tid_tree->t_sharename; 16293bc28dbSGordon Ross 16393bc28dbSGordon Ross soi_curpath = (P->fid_ofile == NULL || 16493bc28dbSGordon Ross P->fid_ofile->f_node == NULL || 16593bc28dbSGordon Ross P->fid_ofile->f_node->vp == NULL || 16693bc28dbSGordon Ross P->fid_ofile->f_node->vp->v_path == NULL) ? "<NULL>" : 16793bc28dbSGordon Ross P->fid_ofile->f_node->vp->v_path; 16893bc28dbSGordon Ross }; 169