forked from osmocom/wireshark
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 svn path=/trunk/; revision=17974
This commit is contained in:
parent
47bb33f1cb
commit
acbaf3fe1f
|
@ -149,6 +149,19 @@ typedef struct _itlq_nexus_t {
|
||||||
nstime_t fc_time;
|
nstime_t fc_time;
|
||||||
} itlq_nexus_t;
|
} 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 */
|
/* FC header structure */
|
||||||
typedef struct _fc_hdr {
|
typedef struct _fc_hdr {
|
||||||
address s_id;
|
address s_id;
|
||||||
|
|
|
@ -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);
|
sns_tvb=tvb_new_subset(tvb, offset, MIN(snslen, tvb_length_remaining(tvb, offset)), snslen);
|
||||||
dissect_scsi_snsinfo (sns_tvb, pinfo, parent_tree, 0,
|
dissect_scsi_snsinfo (sns_tvb, pinfo, parent_tree, 0,
|
||||||
snslen,
|
snslen,
|
||||||
fchdr->itlq->lun);
|
fchdr->itlq, itl);
|
||||||
|
|
||||||
offset+=snslen;
|
offset+=snslen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
data_tvb=tvb_new_subset(tvb, offset, tvb_len, tvb_rlen);
|
||||||
dissect_scsi_snsinfo (data_tvb, pinfo, tree, 0,
|
dissect_scsi_snsinfo (data_tvb, pinfo, tree, 0,
|
||||||
tvb_len,
|
tvb_len,
|
||||||
cdata->itlq.lun);
|
&cdata->itlq, itl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1278,7 +1278,17 @@ dissect_execute_cdb_sns(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre
|
||||||
offset += 4;
|
offset += 4;
|
||||||
|
|
||||||
if (sns_len != 0) {
|
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;
|
offset += sns_len_full;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,19 +54,17 @@
|
||||||
* o dissect_scsi_snsinfo - invoked to decode the sense data provided in case of
|
* o dissect_scsi_snsinfo - invoked to decode the sense data provided in case of
|
||||||
* an error.
|
* an error.
|
||||||
* void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint,
|
* 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
|
* 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,
|
* provide ITL and ITLQ structures that are persistent.
|
||||||
* 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
|
* The ITL structure uniquely identifies a Initiator/Target/Lun combination
|
||||||
* numbers. This is to be provided to the SCSI decoder via the private_data
|
* and is among other things used to keep track of the device type for a
|
||||||
* field in the packet_info data structure. The private_data field is treated
|
* specific LUN.
|
||||||
* as a pointer to a "scsi_task_id_t" structure, containing a conversation
|
*
|
||||||
* ID (a number uniquely identifying a conversation between a particular
|
* The ITLQ structure uniquely identifies a specific scsi task and is used to
|
||||||
* initiator and target, e.g. between two Fibre Channel addresses or between
|
* keep track of OPCODEs between CDB/DATA/Responses and resp[onse times.
|
||||||
* two TCP address/port pairs for iSCSI or NDMP) and a task ID (a number
|
|
||||||
* uniquely identifying a task within that conversation).
|
|
||||||
*
|
*
|
||||||
* This decoder attempts to track the type of SCSI device based on the response
|
* 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,
|
* to the Inquiry command. If the trace does not contain an Inquiry command,
|
||||||
|
@ -89,6 +87,7 @@
|
||||||
#include <epan/prefs.h>
|
#include <epan/prefs.h>
|
||||||
#include <epan/emem.h>
|
#include <epan/emem.h>
|
||||||
#include <epan/conversation.h>
|
#include <epan/conversation.h>
|
||||||
|
#include <epan/tap.h>
|
||||||
#include "packet-fc.h"
|
#include "packet-fc.h"
|
||||||
#include "packet-scsi.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_bqueflags = -1;
|
||||||
static gint ett_scsi_inq_reladrflags = -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
|
/* 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
|
* the device is truncated due to a too short allocation_length specified
|
||||||
* in the command CDB.
|
* in the command CDB.
|
||||||
|
@ -1696,12 +1697,6 @@ const true_false_string scsi_senddiag_pf_val = {
|
||||||
static gint scsi_def_devtype = SCSI_DEV_SBC;
|
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 */
|
/* list of commands for each commandset */
|
||||||
typedef void (*scsi_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
|
typedef void (*scsi_dissector_t)(tvbuff_t *tvb, packet_info *pinfo,
|
||||||
proto_tree *tree, guint offset,
|
proto_tree *tree, guint offset,
|
||||||
|
@ -6299,6 +6294,13 @@ dissect_scsi_rsp (tvbuff_t *tvb, packet_info *pinfo,
|
||||||
proto_item *ti;
|
proto_item *ti;
|
||||||
proto_tree *scsi_tree = NULL;
|
proto_tree *scsi_tree = NULL;
|
||||||
cmdset_t *csdata;
|
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);
|
csdata=get_cmdset_data(itlq, itl);
|
||||||
|
|
||||||
|
@ -6350,11 +6352,19 @@ dissect_scsi_rsp (tvbuff_t *tvb, packet_info *pinfo,
|
||||||
|
|
||||||
void
|
void
|
||||||
dissect_scsi_snsinfo (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
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_item *ti;
|
||||||
proto_tree *sns_tree=NULL;
|
proto_tree *sns_tree=NULL;
|
||||||
const char *old_proto;
|
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;
|
old_proto=pinfo->current_proto;
|
||||||
pinfo->current_proto="SCSI";
|
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);
|
PROTO_ITEM_SET_GENERATED(ti);
|
||||||
if (check_col (pinfo->cinfo, COL_INFO)) {
|
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);
|
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 = ep_alloc(sizeof(scsi_task_data_t));
|
||||||
cdata->itl=itl;
|
cdata->itl=itl;
|
||||||
cdata->itlq=itlq;
|
cdata->itlq=itlq;
|
||||||
|
cdata->type=SCSI_PDU_TYPE_CDB;
|
||||||
|
tap_queue_packet(scsi_tap, pinfo, cdata);
|
||||||
|
|
||||||
if (tree) {
|
if (tree) {
|
||||||
ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, 0,
|
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 = ep_alloc(sizeof(scsi_task_data_t));
|
||||||
cdata->itl=itl;
|
cdata->itl=itl;
|
||||||
cdata->itlq=itlq;
|
cdata->itlq=itlq;
|
||||||
|
cdata->type=SCSI_PDU_TYPE_CDB;
|
||||||
|
tap_queue_packet(scsi_tap, pinfo, cdata);
|
||||||
|
|
||||||
csdata=get_cmdset_data(itlq, itl);
|
csdata=get_cmdset_data(itlq, itl);
|
||||||
|
|
||||||
|
@ -8741,3 +8755,9 @@ proto_register_scsi (void)
|
||||||
&scsi_def_devtype, scsi_devtype_options, TRUE);
|
&scsi_def_devtype, scsi_devtype_options, TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
proto_reg_handoff_scsi(void)
|
||||||
|
{
|
||||||
|
scsi_tap = register_tap("scsi");
|
||||||
|
}
|
||||||
|
|
|
@ -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_rsp (tvbuff_t *, packet_info *, proto_tree *, itlq_nexus_t *, itl_nexus_t *, guint8);
|
||||||
void dissect_scsi_payload (tvbuff_t *, packet_info *, proto_tree *,
|
void dissect_scsi_payload (tvbuff_t *, packet_info *, proto_tree *,
|
||||||
gboolean, itlq_nexus_t *, itl_nexus_t *);
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue