pass the relative data offset of data in/out pdu's to the scsi data in/out dissector (dissect_scsi_payload) so that we can later add reassembly of data pdu's

and also (if reassembly is disabled) only dissect the initial (offset==0) data pdu.

dissect_scsi_payload() does not yet use this parameter.


now that we have both data offset and expected data length/bidir expected data length and also the read/write flags availabe we have what we need to reassemble data in/out pdus    (modulo overflow/underflow  but those are so rare we can worry about them later).


ndmp:   ndmp conceptually always has a data in and a data out phase and never fragment the data into smaller pdu's os that dissector always report offset as 0.





svn path=/trunk/; revision=19511
This commit is contained in:
Ronnie Sahlberg 2006-10-13 09:16:45 +00:00
parent d516bcbb78
commit 8826c144f7
5 changed files with 19 additions and 7 deletions

View File

@ -491,7 +491,7 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro
static void
dissect_fcp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, conversation_t *conversation, fc_hdr *fchdr, itl_nexus_t *itl)
{
dissect_scsi_payload(tvb, pinfo, parent_tree, FALSE, fchdr->itlq, itl);
dissect_scsi_payload(tvb, pinfo, parent_tree, FALSE, fchdr->itlq, itl, fchdr->relative_offset);
}
/* fcp-3 9.5 table 24 */

View File

@ -756,6 +756,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
itl_nexus_t *itl=NULL;
guint ahs_cdb_length=0;
guint ahs_cdb_offset=0;
guint32 data_offset=0;
if(paddedDataSegmentLength & 3)
paddedDataSegmentLength += 4 - (paddedDataSegmentLength & 3);
@ -1312,6 +1313,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
proto_tree_add_item(ti, hf_iscsi_ExpStatSN, tvb, offset + 28, 4, FALSE);
proto_tree_add_item(ti, hf_iscsi_DataSN, tvb, offset + 36, 4, FALSE);
proto_tree_add_item(ti, hf_iscsi_BufferOffset, tvb, offset + 40, 4, FALSE);
data_offset=tvb_get_ntohl(tvb, offset+40);
offset = handleHeaderDigest(iscsi_session, ti, tvb, offset, 48);
/* do not update offset here because the data segment is
* dissected below */
@ -1356,6 +1359,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
proto_tree_add_item(ti, hf_iscsi_MaxCmdSN, tvb, offset + 32, 4, FALSE);
proto_tree_add_item(ti, hf_iscsi_DataSN, tvb, offset + 36, 4, FALSE);
proto_tree_add_item(ti, hf_iscsi_BufferOffset, tvb, offset + 40, 4, FALSE);
data_offset=tvb_get_ntohl(tvb, offset+40);
if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) {
proto_tree_add_item(ti, hf_iscsi_SCSIData_ResidualCount, tvb, offset + 44, 4, FALSE);
}
@ -1604,7 +1609,8 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
data_tvb=tvb_new_subset(tvb, immediate_data_offset, tvb_len, tvb_rlen);
dissect_scsi_payload (data_tvb, pinfo, tree,
TRUE,
&cdata->itlq, itl);
&cdata->itlq, itl,
0);
}
}
else if (opcode == ISCSI_OPCODE_SCSI_RESPONSE) {
@ -1652,7 +1658,8 @@ 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_payload (data_tvb, pinfo, tree,
(opcode==ISCSI_OPCODE_SCSI_DATA_OUT),
&cdata->itlq, itl);
&cdata->itlq, itl,
data_offset);
}
if(S_bit){

View File

@ -1242,7 +1242,9 @@ dissect_execute_cdb_payload(tvbuff_t *tvb, int offset, packet_info *pinfo, proto
if(ndmp_conv_data->task->itlq){
dissect_scsi_payload(data_tvb, pinfo, top_tree, isreq,
ndmp_conv_data->task->itlq, get_itl_nexus(ndmp_conv_data, pinfo, FALSE));
ndmp_conv_data->task->itlq,
get_itl_nexus(ndmp_conv_data, pinfo, FALSE),
0);
}
offset += payload_len_full;
}

View File

@ -46,7 +46,8 @@
* guint, itlq_nexus_t *, itl_nexus_t *);
* o dissect_scsi_payload - invoked to decode SCSI responses
* void dissect_scsi_payload (tvbuff_t *, packet_info *, proto_tree *, guint,
* gboolean, itlq_nexusu_t *, itl_nexus_t *);
* gboolean, itlq_nexusu_t *, itl_nexus_t *,
* guint32 relative_offset);
* The final parameter is the length of the response field that is negotiated
* as part of the SCSI transport layer. If this is not tracked by the
* transport, it can be set to 0.
@ -7792,7 +7793,8 @@ dissect_scsi_cdb (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
void
dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean isreq, itlq_nexus_t *itlq, itl_nexus_t *itl)
gboolean isreq, itlq_nexus_t *itlq, itl_nexus_t *itl,
guint32 relative_offset _U_)
{
int offset=0;
proto_item *ti;

View File

@ -190,7 +190,8 @@ void dissect_scsi_cdb (tvbuff_t *, packet_info *, proto_tree *,
gint, itlq_nexus_t *, itl_nexus_t *);
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 *);
gboolean, itlq_nexus_t *, itl_nexus_t *,
guint32 relative_offset);
void dissect_scsi_snsinfo (tvbuff_t *, packet_info *, proto_tree *, guint, guint, itlq_nexus_t *, itl_nexus_t *);
WS_VAR_IMPORT const value_string scsi_sbc2_vals[];