aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2013-05-18 16:26:26 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2013-05-18 16:26:26 +0000
commit783cf2eff28d013d689fc7ed973b1602a7fe905d (patch)
treef994c56e2d8bf905518250ffe86596f18a315e2c /epan
parenta9ced211ac16619dc6f0b1cf77c680b096f357aa (diff)
SCSI: Add dissection of REPORT SUPPORTED OPCODES
svn path=/trunk/; revision=49408
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-scsi-mmc.c3
-rw-r--r--epan/dissectors/packet-scsi-osd.c3
-rw-r--r--epan/dissectors/packet-scsi-sbc.c3
-rw-r--r--epan/dissectors/packet-scsi-smc.c3
-rw-r--r--epan/dissectors/packet-scsi-ssc.c3
-rw-r--r--epan/dissectors/packet-scsi.c183
-rw-r--r--epan/dissectors/packet-scsi.h7
7 files changed, 197 insertions, 8 deletions
diff --git a/epan/dissectors/packet-scsi-mmc.c b/epan/dissectors/packet-scsi-mmc.c
index 9caf160a9d..177f129263 100644
--- a/epan/dissectors/packet-scsi-mmc.c
+++ b/epan/dissectors/packet-scsi-mmc.c
@@ -1312,6 +1312,7 @@ const value_string scsi_mmc_vals[] = {
{SCSI_MMC4_GETEVENTSTATUSNOTIFY , "Get Event Status Notification"},
{SCSI_MMC4_GETPERFORMANCE , "Get Performance"},
{SCSI_SPC_INQUIRY , "Inquiry"},
+ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
{SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
{SCSI_SPC_MODESENSE10 , "Mode Sense(10)"},
{SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
@@ -1520,7 +1521,7 @@ scsi_cdb_table_t scsi_mmc_table[256] = {
/*SPC 0xa0*/{dissect_spc_reportluns},
/*MMC 0xa1*/{NULL},
/*MMC 0xa2*/{NULL},
-/*MMC 0xa3*/{NULL},
+/*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
/*MMC 0xa4*/{dissect_mmc4_reportkey},
/*MMC 0xa5*/{NULL},
/*MMC 0xa6*/{NULL},
diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c
index 6af7f9e657..2e566bbf39 100644
--- a/epan/dissectors/packet-scsi-osd.c
+++ b/epan/dissectors/packet-scsi-osd.c
@@ -2712,6 +2712,7 @@ const value_string scsi_osd_vals[] = {
{SCSI_SPC_INQUIRY , "Inquiry"},
{SCSI_SPC_LOGSELECT , "Log Select"},
{SCSI_SPC_LOGSENSE , "Log Sense"},
+ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
{SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
{SCSI_SPC_MODESENSE10 , "Mode Sense(10)"},
{SCSI_SPC_PERSRESVIN , "Persistent Reserve In"},
@@ -2887,7 +2888,7 @@ scsi_cdb_table_t scsi_osd_table[256] = {
/*OSD 0xa0*/{dissect_spc_reportluns},
/*OSD 0xa1*/{NULL},
/*OSD 0xa2*/{NULL},
-/*OSD 0xa3*/{NULL},
+/*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
/*OSD 0xa4*/{NULL},
/*OSD 0xa5*/{NULL},
/*OSD 0xa6*/{NULL},
diff --git a/epan/dissectors/packet-scsi-sbc.c b/epan/dissectors/packet-scsi-sbc.c
index c52f98f2a3..dcac0d5ab7 100644
--- a/epan/dissectors/packet-scsi-sbc.c
+++ b/epan/dissectors/packet-scsi-sbc.c
@@ -1439,6 +1439,7 @@ const value_string scsi_sbc_vals[] = {
{SCSI_SBC_LOCKUNLKCACHE16 , "Lock Unlock Cache(16)"},
{SCSI_SPC_LOGSELECT , "Log Select"},
{SCSI_SPC_LOGSENSE , "Log Sense"},
+ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
{SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
{SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
{SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
@@ -1670,7 +1671,7 @@ scsi_cdb_table_t scsi_sbc_table[256] = {
/*SPC 0xa0*/{dissect_spc_reportluns},
/*SBC 0xa1*/{NULL},
/*SBC 0xa2*/{NULL},
-/*SBC 0xa3*/{NULL},
+/*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
/*SBC 0xa4*/{NULL},
/*SBC 0xa5*/{NULL},
/*SBC 0xa6*/{NULL},
diff --git a/epan/dissectors/packet-scsi-smc.c b/epan/dissectors/packet-scsi-smc.c
index 63ff74161b..05434e58fb 100644
--- a/epan/dissectors/packet-scsi-smc.c
+++ b/epan/dissectors/packet-scsi-smc.c
@@ -576,6 +576,7 @@ const value_string scsi_smc_vals[] = {
{SCSI_SPC_INQUIRY , "Inquiry"},
{SCSI_SPC_LOGSELECT , "Log Select"},
{SCSI_SPC_LOGSENSE , "Log Sense"},
+ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
{SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
{SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
{SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
@@ -772,7 +773,7 @@ scsi_cdb_table_t scsi_smc_table[256] = {
/*SPC 0xa0*/{dissect_spc_reportluns},
/*SMC 0xa1*/{NULL},
/*SMC 0xa2*/{NULL},
-/*SMC 0xa3*/{NULL},
+/*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
/*SMC 0xa4*/{NULL},
/*SMC 0xa5*/{dissect_smc_movemedium},
/*SMC 0xa6*/{dissect_smc_exchangemedium},
diff --git a/epan/dissectors/packet-scsi-ssc.c b/epan/dissectors/packet-scsi-ssc.c
index ae34ed4a26..ef1a5a27fa 100644
--- a/epan/dissectors/packet-scsi-ssc.c
+++ b/epan/dissectors/packet-scsi-ssc.c
@@ -919,6 +919,7 @@ const value_string scsi_ssc_vals[] = {
{SCSI_SSC_LOCATE_16 , "Locate(16)"},
{SCSI_SPC_LOGSELECT , "Log Select"},
{SCSI_SPC_LOGSENSE , "Log Sense"},
+ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
{SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
{SCSI_SPC_RESERVE6 , "Reserve(6)"},
{SCSI_SPC_RELEASE6 , "Release(6)"},
@@ -1123,7 +1124,7 @@ scsi_cdb_table_t scsi_ssc_table[256] = {
/*SPC 0xa0*/{dissect_spc_reportluns},
/*SSC 0xa1*/{NULL},
/*SSC 0xa2*/{NULL},
-/*SSC 0xa3*/{NULL},
+/*SPC 0xa3*/{dissect_spc_mgmt_protocol_in},
/*SSC 0xa4*/{NULL},
/*SSC 0xa5*/{dissect_smc_movemedium},
/*SSC 0xa6*/{NULL},
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c
index 8769be627e..adf0e56183 100644
--- a/epan/dissectors/packet-scsi.c
+++ b/epan/dissectors/packet-scsi.c
@@ -327,6 +327,16 @@ static int hf_scsi_block_limits_uga = -1;
static int hf_scsi_block_limits_mwsl = -1;
static int hf_scsi_prevent_allow_flags = -1;
static int hf_scsi_prevent_allow_prevent = -1;
+static int hf_scsi_mpi_service_action = -1;
+static int hf_scsi_report_opcodes_rctd = -1;
+static int hf_scsi_report_opcodes_options = -1;
+static int hf_scsi_report_opcodes_requested_o = -1;
+static int hf_scsi_report_opcodes_requested_sa = -1;
+static int hf_scsi_report_opcodes_cdl = -1;
+static int hf_scsi_report_opcodes_sa = -1;
+static int hf_scsi_report_opcodes_ctdp = -1;
+static int hf_scsi_report_opcodes_servactv = -1;
+static int hf_scsi_report_opcodes_cdb_length = -1;
static gint ett_scsi = -1;
static gint ett_scsi_page = -1;
@@ -347,6 +357,7 @@ static gint ett_scsi_fragment = -1;
static gint ett_persresv_control = -1;
static gint ett_scsi_lun = -1;
static gint ett_scsi_prevent_allow = -1;
+static gint ett_command_descriptor = -1;
static int scsi_tap = -1;
@@ -415,6 +426,7 @@ static const value_string scsi_spc_vals[] = {
{SCSI_SPC_INQUIRY , "Inquiry"},
{SCSI_SPC_LOGSELECT , "Log Select"},
{SCSI_SPC_LOGSENSE , "Log Sense"},
+ {SCSI_SPC_MGMT_PROTOCOL_IN , "Mgmt Protocol In"},
{SCSI_SPC_MODESELECT6 , "Mode Select(6)"},
{SCSI_SPC_MODESELECT10 , "Mode Select(10)"},
{SCSI_SPC_MODESENSE6 , "Mode Sense(6)"},
@@ -427,7 +439,6 @@ static const value_string scsi_spc_vals[] = {
{SCSI_SPC_READBUFFER , "Read Buffer"},
{SCSI_SPC_RELEASE6 , "Release(6)"},
{SCSI_SPC_RELEASE10 , "Release(10)"},
- {SCSI_SPC_REPORTDEVICEID , "Report Device ID"},
{SCSI_SPC_REPORTLUNS , "Report LUNs"},
{SCSI_SPC_REQSENSE , "Request Sense"},
{SCSI_SPC_RESERVE6 , "Reserve(6)"},
@@ -4275,6 +4286,142 @@ dissect_spc_reportluns(tvbuff_t *tvb, packet_info *pinfo _U_,
}
}
+const value_string mpi_action_vals[] = {
+ {MPI_MANAGEMENT_PROTOCOL_IN , "Management Protocol In"},
+ {MPI_REPORT_SUPPORTED_OPERATION_CODES , "Report Supported Opcodes"},
+ {0, NULL}
+};
+
+void
+dissect_spc_mgmt_protocol_in(tvbuff_t *tvb, packet_info *pinfo _U_,
+ proto_tree *tree, guint offset,
+ gboolean isreq, gboolean iscdb,
+ guint payload_len _U_,
+ scsi_task_data_t *cdata _U_)
+{
+ tvbuff_t *volatile tvb_v = tvb;
+ volatile guint offset_v = offset;
+ guint8 service_action;
+
+ if (isreq && iscdb) {
+ service_action = tvb_get_guint8 (tvb_v, offset_v) & 0x1F;
+ if (cdata) {
+ cdata->itlq->flags=service_action;
+ }
+ col_append_str(pinfo->cinfo, COL_INFO,
+ val_to_str(service_action, mpi_action_vals, "Unknown"));
+
+ proto_tree_add_item(tree, hf_scsi_mpi_service_action, tvb_v,
+ offset_v, 1, ENC_BIG_ENDIAN);
+
+ switch(service_action){
+ case MPI_REPORT_SUPPORTED_OPERATION_CODES:
+ proto_tree_add_item(tree, hf_scsi_report_opcodes_rctd,
+ tvb_v, offset_v+1, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_scsi_report_opcodes_options,
+ tvb_v, offset_v+1, 1, ENC_BIG_ENDIAN);
+ if (cdata && (tvb_get_guint8(tvb_v, offset_v+1) & 0x07)) {
+ /* Need the one-command parameter format */
+ cdata->itlq->flags|=0x80;
+ }
+
+ proto_tree_add_item(tree, hf_scsi_report_opcodes_requested_o,
+ tvb_v, offset_v+2, 1, ENC_BIG_ENDIAN);
+ proto_tree_add_item(tree, hf_scsi_report_opcodes_requested_sa,
+ tvb_v, offset_v+3, 2, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(tree, hf_scsi_alloclen32, tvb_v,
+ offset_v+5, 4, ENC_BIG_ENDIAN);
+ if (cdata) {
+ cdata->itlq->alloc_len = tvb_get_ntohl(tvb_v, offset_v+5);
+ }
+ break;
+ default:
+ proto_tree_add_text(tree, tvb_v, offset_v+1, 8,
+ "No dissection for this service action yet");
+ }
+
+ proto_tree_add_bitmask(tree, tvb_v, offset_v+10, hf_scsi_control,
+ ett_scsi_control, cdb_control_fields, ENC_BIG_ENDIAN);
+
+ } else if (!isreq) {
+ proto_item *it;
+ int length;
+ cmdset_t *csdata;
+
+ if (!cdata || !cdata->itlq || !cdata->itl) {
+ return;
+ }
+
+ csdata = get_cmdset_data(cdata->itlq, cdata->itl);
+
+ it = proto_tree_add_uint(tree, hf_scsi_mpi_service_action, tvb_v, 0, 0, cdata->itlq->flags & 0x7f);
+ PROTO_ITEM_SET_GENERATED(it);
+
+ TRY_SCSI_CDB_ALLOC_LEN(pinfo, tvb_v, offset_v, cdata->itlq->alloc_len);
+
+ switch (cdata->itlq->flags & 0x7f) {
+ case MPI_REPORT_SUPPORTED_OPERATION_CODES:
+ if (cdata->itlq->flags & 0x80) {
+ /* one-command format */
+ } else {
+ /* all commands format */
+ proto_tree_add_item(tree, hf_scsi_report_opcodes_cdl,
+ tvb_v, offset_v+0, 4, ENC_BIG_ENDIAN);
+ length = tvb_get_ntohl(tvb_v, offset_v);
+ offset_v += 4;
+
+ while (length >= 20) {
+ proto_tree *tr;
+ int ctdp;
+
+ it = proto_tree_add_text(tree, tvb_v, offset_v,
+ 20, "Command Descriptor: %s",
+ val_to_str(tvb_get_guint8(tvb_v, offset_v+0), csdata->cdb_vals, "Unknown"));
+ tr = proto_item_add_subtree(it,
+ ett_command_descriptor);
+
+ proto_tree_add_item(tr, csdata->hf_opcode,
+ tvb_v, offset_v+0, 1, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(tr, hf_scsi_report_opcodes_sa,
+ tvb_v, offset_v+2, 2, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(tr, hf_scsi_report_opcodes_ctdp,
+ tvb_v, offset_v+5, 1, ENC_BIG_ENDIAN);
+ ctdp = tvb_get_guint8(tvb_v, offset_v+5) & 0x02;
+
+ proto_tree_add_item(tr, hf_scsi_report_opcodes_servactv,
+ tvb_v, offset_v+5, 1, ENC_BIG_ENDIAN);
+
+ proto_tree_add_item(tr, hf_scsi_report_opcodes_cdb_length,
+ tvb_v, offset_v+6, 2, ENC_BIG_ENDIAN);
+
+ offset_v += 8;
+ length -= 8;
+
+ if (!ctdp) {
+ continue;
+ }
+
+ proto_tree_add_text(tree, tvb_v, offset_v, 12,
+ "No dissection for command timeouts descriptor yet");
+
+ offset_v += 12;
+ length -= 12;
+
+ }
+ }
+ break;
+ default:
+ proto_tree_add_text(tree, tvb_v, offset_v+1, 8,
+ "No dissection for this service action yet");
+ }
+
+ END_TRY_SCSI_CDB_ALLOC_LEN;
+ }
+}
+
static void
dissect_scsi_fix_snsinfo(tvbuff_t *tvb, proto_tree *sns_tree, guint offset)
{
@@ -5898,6 +6045,37 @@ proto_register_scsi(void)
{ &hf_scsi_prevent_allow_prevent,
{ "PREVENT", "scsi.prevent_allow.prevent", FT_BOOLEAN, 8,
NULL, 0x01, NULL, HFILL}},
+ { &hf_scsi_mpi_service_action,
+ { "Service Action", "scsi.mpi.service_action", FT_UINT8, BASE_HEX,
+ VALS(mpi_action_vals), 0x1f, "Management Protocol In Service Action", HFILL }},
+ { &hf_scsi_report_opcodes_rctd,
+ { "RCTD", "scsi.report_opcodes.rctd", FT_BOOLEAN, 8,
+ NULL, 0x80, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_options,
+ { "Reporting Options", "scsi.report_opcodes.options", FT_UINT8, BASE_HEX,
+ NULL, 0x07, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_requested_o,
+ { "Requested Operation Code", "scsi.report_opcodes.requested_operation_code", FT_UINT8, BASE_HEX,
+ NULL, 0, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_requested_sa,
+ { "Requested Service Action", "scsi.report_opcodes.requested_service_action", FT_UINT16, BASE_HEX,
+ NULL, 0, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_cdl,
+ { "Command Data Length", "scsi.report_opcodes.command_data_length", FT_UINT32, BASE_DEC,
+ NULL, 0, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_sa,
+ { "Service Action", "scsi.report_opcodes.service_action", FT_UINT16, BASE_DEC,
+ NULL, 0, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_ctdp,
+ { "CTDP", "scsi.report_opcodes.ctdp", FT_BOOLEAN, 8,
+ NULL, 0x02, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_servactv,
+ { "SERVACTV", "scsi.report_opcodes.servactv", FT_BOOLEAN, 8,
+ NULL, 0x01, NULL, HFILL}},
+ { &hf_scsi_report_opcodes_cdb_length,
+ { "CDB Length", "scsi.report_opcodes.cdb_length", FT_UINT16, BASE_DEC,
+ NULL, 0, NULL, HFILL}},
+
};
/* Setup protocol subtree array */
@@ -5920,7 +6098,8 @@ proto_register_scsi(void)
&ett_scsi_fragment,
&ett_persresv_control,
&ett_scsi_lun,
- &ett_scsi_prevent_allow
+ &ett_scsi_prevent_allow,
+ &ett_command_descriptor
};
module_t *scsi_module;
diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h
index 2b7fe5133e..68074e1f90 100644
--- a/epan/dissectors/packet-scsi.h
+++ b/epan/dissectors/packet-scsi.h
@@ -130,7 +130,7 @@ typedef struct _scsi_cdb_table_t {
#define SCSI_SPC_RCVDIAGRESULTS 0x1C
#define SCSI_SPC_RELEASE6 0x17
#define SCSI_SPC_RELEASE10 0x57
-#define SCSI_SPC_REPORTDEVICEID 0xA3
+#define SCSI_SPC_MGMT_PROTOCOL_IN 0xA3
#define SCSI_SPC_REPORTLUNS 0xA0
#define SCSI_SPC_REQSENSE 0x03
#define SCSI_SPC_RESERVE6 0x16
@@ -144,6 +144,7 @@ typedef struct _scsi_cdb_table_t {
void dissect_spc_inquiry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint32 payload_len, scsi_task_data_t *cdata);
void dissect_spc_logselect(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_);
void dissect_spc_logsense(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_);
+void dissect_spc_mgmt_protocol_in(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len _U_, scsi_task_data_t *cdata _U_);
void dissect_spc_modeselect6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len, scsi_task_data_t *cdata);
void dissect_spc_modesense6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len, scsi_task_data_t *cdata);
void dissect_spc_modeselect10(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, gboolean isreq, gboolean iscdb, guint payload_len, scsi_task_data_t *cdata);
@@ -234,6 +235,10 @@ extern const value_string scsi_devid_codeset_val[];
extern const value_string scsi_devid_idtype_val[];
extern value_string_ext scsi_asc_val_ext;
+/* 0xA3 MGMT PROTOCOL IN service actions */
+#define MPI_MANAGEMENT_PROTOCOL_IN 0x10
+#define MPI_REPORT_SUPPORTED_OPERATION_CODES 0x0C
+
/* These two defines are used to handle cases where data coming back from
* the device is truncated due to a too short allocation_length specified
* in the command CDB.