Print this page
Build provider 3rd arg from smb_request_t
hacking...
NEX-1643 dtrace provider for smbsrv
Also illumos 1841:
 DTrace smb provider was mis-implemented, doesn't exist.
Add back handlers for read/write raw, so that
 legacy dtrace consumers can find the probes.
Kill extra arg in smb_negotiate
Fix missing "done" probe with smb_notify
Add example consumer: smb-trace.d
fix soi_pid

*** 71,91 **** param->rw_offset = (uint64_t)off_low; param->rw_count = (uint32_t)count; param->rw_mincnt = 0; ! DTRACE_SMB_2(op__Read__start, smb_request_t *, sr, ! smb_rw_param_t *, param); return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } void smb_post_read(smb_request_t *sr) { ! DTRACE_SMB_2(op__Read__done, smb_request_t *, sr, ! smb_rw_param_t *, sr->arg.rw); kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); } smb_sdrc_t --- 71,89 ---- param->rw_offset = (uint64_t)off_low; param->rw_count = (uint32_t)count; param->rw_mincnt = 0; ! DTRACE_SMB_1(op__Read__start, smb_request_t *, sr); /* arg.rw */ return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } void smb_post_read(smb_request_t *sr) { ! DTRACE_SMB_1(op__Read__done, smb_request_t *, sr); /* arg.rw */ kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); } smb_sdrc_t
*** 157,177 **** param->rw_offset = (uint64_t)off_low; param->rw_count = (uint32_t)count; param->rw_mincnt = 0; ! DTRACE_SMB_2(op__LockAndRead__start, smb_request_t *, sr, ! smb_rw_param_t *, param); return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } void smb_post_lock_and_read(smb_request_t *sr) { ! DTRACE_SMB_2(op__LockAndRead__done, smb_request_t *, sr, ! smb_rw_param_t *, sr->arg.rw); kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); } smb_sdrc_t --- 155,173 ---- param->rw_offset = (uint64_t)off_low; param->rw_count = (uint32_t)count; param->rw_mincnt = 0; ! DTRACE_SMB_1(op__LockAndRead__start, smb_request_t *, sr); /* arg.rw */ return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } void smb_post_lock_and_read(smb_request_t *sr) { ! DTRACE_SMB_1(op__LockAndRead__done, smb_request_t *, sr); /* arg.rw */ kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); } smb_sdrc_t
*** 221,230 **** --- 217,281 ---- return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } /* + * The SMB_COM_READ_RAW protocol was a negotiated option introduced in + * SMB Core Plus to maximize performance when reading a large block + * of data from a server. It's obsolete and no longer supported. + * + * We keep a handler for it so the dtrace provider can see if + * the client tried to use this command. + */ + smb_sdrc_t + smb_pre_read_raw(smb_request_t *sr) + { + smb_rw_param_t *param; + uint32_t off_low; + uint32_t off_high; + uint32_t timeout; + uint16_t count; + int rc; + + param = kmem_zalloc(sizeof (smb_rw_param_t), KM_SLEEP); + sr->arg.rw = param; + if (sr->smb_wct == 8) { + rc = smbsr_decode_vwv(sr, "wlwwl2.", &sr->smb_fid, + &off_low, &count, &param->rw_mincnt, &timeout); + if (rc == 0) { + param->rw_offset = (uint64_t)off_low; + param->rw_count = (uint32_t)count; + } + } else { + rc = smbsr_decode_vwv(sr, "wlwwl2.l", &sr->smb_fid, + &off_low, &count, &param->rw_mincnt, &timeout, &off_high); + if (rc == 0) { + param->rw_offset = ((uint64_t)off_high << 32) | off_low; + param->rw_count = (uint32_t)count; + } + } + DTRACE_SMB_1(op__ReadRaw__start, smb_request_t *, sr); /* arg.rw */ + return (SDRC_SUCCESS); + } + + void + smb_post_read_raw(smb_request_t *sr) + { + DTRACE_SMB_1(op__ReadRaw__done, smb_request_t *, sr); /* arg.rw */ + + kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); + } + + smb_sdrc_t + smb_com_read_raw(smb_request_t *sr) + { + smbsr_error(sr, NT_STATUS_NOT_SUPPORTED, ERRDOS, + ERROR_NOT_SUPPORTED); + return (SDRC_ERROR); + } + + /* * Read bytes from a file (SMB Core). This request was extended in * LM 0.12 to support 64-bit offsets, indicated by sending a wct of * 12 and including additional offset information. * * MS-SMB 3.3.5.7 update to LM 0.12 4.2.4:
*** 270,290 **** param->rw_count = (uint32_t)maxcnt_low; } param->rw_mincnt = 0; ! DTRACE_SMB_2(op__ReadX__start, smb_request_t *, sr, ! smb_rw_param_t *, param); return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } void smb_post_read_andx(smb_request_t *sr) { ! DTRACE_SMB_2(op__ReadX__done, smb_request_t *, sr, ! smb_rw_param_t *, sr->arg.rw); kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); } smb_sdrc_t --- 321,339 ---- param->rw_count = (uint32_t)maxcnt_low; } param->rw_mincnt = 0; ! DTRACE_SMB_1(op__ReadX__start, smb_request_t *, sr); /* arg.rw */ return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR); } void smb_post_read_andx(smb_request_t *sr) { ! DTRACE_SMB_1(op__ReadX__done, smb_request_t *, sr); /* arg.rw */ kmem_free(sr->arg.rw, sizeof (smb_rw_param_t)); } smb_sdrc_t