diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-04-24 08:16:18 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-04-24 08:16:18 +0000 |
commit | 1bf271d15f259cf76af2cdc64f9b6d949a4f55dc (patch) | |
tree | a5edf4b3a5f73a34b8894d5f47285b35ebf02308 | |
parent | 2b8e972f358c884ffd5a74aa7352d37f7b7a17cc (diff) |
change the signature for dissect_scsi_snsinfo() to take itlq and itl structures
update the comment in packet-scsi.c to reflect that it is the transport now that is responsible to track itl and itlq data
make scsi tapable
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17974 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/packet-fc.h | 13 | ||||
-rw-r--r-- | epan/dissectors/packet-fcp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-iscsi.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ndmp.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.c | 60 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.h | 2 |
6 files changed, 67 insertions, 24 deletions
diff --git a/epan/dissectors/packet-fc.h b/epan/dissectors/packet-fc.h index a517a97e54..3edce016a7 100644 --- a/epan/dissectors/packet-fc.h +++ b/epan/dissectors/packet-fc.h @@ -149,6 +149,19 @@ typedef struct _itlq_nexus_t { nstime_t fc_time; } itlq_nexus_t; + +#define SCSI_PDU_TYPE_CDB 1 +#define SCSI_PDU_TYPE_DATA 2 +#define SCSI_PDU_TYPE_RSP 4 +#define SCSI_PDU_TYPE_SNS 5 +typedef struct _scsi_task_data { + int type; + itlq_nexus_t *itlq; + itl_nexus_t *itl; +} scsi_task_data_t; + + + /* FC header structure */ typedef struct _fc_hdr { address s_id; diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c index 8e169a5883..236d4e9822 100644 --- a/epan/dissectors/packet-fcp.c +++ b/epan/dissectors/packet-fcp.c @@ -559,7 +559,7 @@ dissect_fcp_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, prot sns_tvb=tvb_new_subset(tvb, offset, MIN(snslen, tvb_length_remaining(tvb, offset)), snslen); dissect_scsi_snsinfo (sns_tvb, pinfo, parent_tree, 0, snslen, - fchdr->itlq->lun); + fchdr->itlq, itl); offset+=snslen; } diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index 7b92e82caa..5ba8c385e3 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -1539,7 +1539,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off data_tvb=tvb_new_subset(tvb, offset, tvb_len, tvb_rlen); dissect_scsi_snsinfo (data_tvb, pinfo, tree, 0, tvb_len, - cdata->itlq.lun); + &cdata->itlq, itl); } } } diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index 6d490f3bb9..2fd8a09c30 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -1278,7 +1278,17 @@ dissect_execute_cdb_sns(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre offset += 4; if (sns_len != 0) { - dissect_scsi_snsinfo(tvb, pinfo, tree, offset, sns_len, 0xffff); + itlq_nexus_t itlq; + + /* create a fake itlq structure until we have proper + * tracking in ndmp + */ + itlq.lun=0xffff; + + itlq.first_exchange_frame=0; + itlq.last_exchange_frame=0; + itlq.scsi_opcode=0xffff; + dissect_scsi_snsinfo(tvb, pinfo, tree, offset, sns_len, &itlq, NULL); offset += sns_len_full; } diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 0bbe036b1d..0d32bac2ac 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -54,19 +54,17 @@ * o dissect_scsi_snsinfo - invoked to decode the sense data provided in case of * an error. * void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint, - * guint, guint16); + * guint, itlq_nexus_t *, itl_nexus_t *); * * In addition to this, the other requirement made from the transport is to - * provide a unique way to determine a SCSI task. In Fibre Channel networks, - * this is the exchange ID pair alongwith the source/destination addresses; in - * iSCSI it is the initiator task tag along with the src/dst address and port - * numbers. This is to be provided to the SCSI decoder via the private_data - * field in the packet_info data structure. The private_data field is treated - * as a pointer to a "scsi_task_id_t" structure, containing a conversation - * ID (a number uniquely identifying a conversation between a particular - * initiator and target, e.g. between two Fibre Channel addresses or between - * two TCP address/port pairs for iSCSI or NDMP) and a task ID (a number - * uniquely identifying a task within that conversation). + * provide ITL and ITLQ structures that are persistent. + * + * The ITL structure uniquely identifies a Initiator/Target/Lun combination + * and is among other things used to keep track of the device type for a + * specific LUN. + * + * The ITLQ structure uniquely identifies a specific scsi task and is used to + * keep track of OPCODEs between CDB/DATA/Responses and resp[onse times. * * This decoder attempts to track the type of SCSI device based on the response * to the Inquiry command. If the trace does not contain an Inquiry command, @@ -89,6 +87,7 @@ #include <epan/prefs.h> #include <epan/emem.h> #include <epan/conversation.h> +#include <epan/tap.h> #include "packet-fc.h" #include "packet-scsi.h" @@ -357,6 +356,8 @@ static gint ett_scsi_inq_sccsflags = -1; static gint ett_scsi_inq_bqueflags = -1; static gint ett_scsi_inq_reladrflags = -1; +static int scsi_tap = -1; + /* 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. @@ -1696,12 +1697,6 @@ const true_false_string scsi_senddiag_pf_val = { static gint scsi_def_devtype = SCSI_DEV_SBC; -typedef struct _scsi_task_data { - itlq_nexus_t *itlq; - itl_nexus_t *itl; -} scsi_task_data_t; - - /* list of commands for each commandset */ typedef void (*scsi_dissector_t)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, @@ -6299,6 +6294,13 @@ dissect_scsi_rsp (tvbuff_t *tvb, packet_info *pinfo, proto_item *ti; proto_tree *scsi_tree = NULL; cmdset_t *csdata; + scsi_task_data_t *cdata; + + cdata = ep_alloc(sizeof(scsi_task_data_t)); + cdata->itl=itl; + cdata->itlq=itlq; + cdata->type=SCSI_PDU_TYPE_RSP; + tap_queue_packet(scsi_tap, pinfo, cdata); csdata=get_cmdset_data(itlq, itl); @@ -6350,11 +6352,19 @@ dissect_scsi_rsp (tvbuff_t *tvb, packet_info *pinfo, void dissect_scsi_snsinfo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - guint offset, guint snslen, guint16 lun) + guint offset, guint snslen, itlq_nexus_t *itlq, itl_nexus_t *itl) { proto_item *ti; proto_tree *sns_tree=NULL; const char *old_proto; + scsi_task_data_t *cdata; + + cdata = ep_alloc(sizeof(scsi_task_data_t)); + cdata->itl=itl; + cdata->itlq=itlq; + cdata->type=SCSI_PDU_TYPE_SNS; + tap_queue_packet(scsi_tap, pinfo, cdata); + old_proto=pinfo->current_proto; pinfo->current_proto="SCSI"; @@ -6366,10 +6376,10 @@ dissect_scsi_snsinfo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } - ti=proto_tree_add_uint(sns_tree, hf_scsi_lun, tvb, 0, 0, lun); + ti=proto_tree_add_uint(sns_tree, hf_scsi_lun, tvb, 0, 0, itlq->lun); PROTO_ITEM_SET_GENERATED(ti); if (check_col (pinfo->cinfo, COL_INFO)) { - col_append_fstr (pinfo->cinfo, COL_INFO, " LUN:0x%02x ", lun); + col_append_fstr (pinfo->cinfo, COL_INFO, " LUN:0x%02x ", itlq->lun); col_set_fence(pinfo->cinfo, COL_INFO); } @@ -7728,6 +7738,8 @@ dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cdata = ep_alloc(sizeof(scsi_task_data_t)); cdata->itl=itl; cdata->itlq=itlq; + cdata->type=SCSI_PDU_TYPE_CDB; + tap_queue_packet(scsi_tap, pinfo, cdata); if (tree) { ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, 0, @@ -7796,6 +7808,8 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cdata = ep_alloc(sizeof(scsi_task_data_t)); cdata->itl=itl; cdata->itlq=itlq; + cdata->type=SCSI_PDU_TYPE_CDB; + tap_queue_packet(scsi_tap, pinfo, cdata); csdata=get_cmdset_data(itlq, itl); @@ -8741,3 +8755,9 @@ proto_register_scsi (void) &scsi_def_devtype, scsi_devtype_options, TRUE); } + +void +proto_reg_handoff_scsi(void) +{ + scsi_tap = register_tap("scsi"); +} diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h index b698673620..d687bfc295 100644 --- a/epan/dissectors/packet-scsi.h +++ b/epan/dissectors/packet-scsi.h @@ -67,6 +67,6 @@ void dissect_scsi_cdb (tvbuff_t *, packet_info *, proto_tree *, void dissect_scsi_rsp (tvbuff_t *, packet_info *, proto_tree *, itlq_nexus_t *, itl_nexus_t *, guint8); void dissect_scsi_payload (tvbuff_t *, packet_info *, proto_tree *, gboolean, itlq_nexus_t *, itl_nexus_t *); -void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint, guint, guint16); +void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint, guint, itlq_nexus_t *, itl_nexus_t *); #endif |