diff options
author | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-10-13 09:16:45 +0000 |
---|---|---|
committer | sahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-10-13 09:16:45 +0000 |
commit | 8710eb7d7f7caac3002ced09eda61964ff85e9dc (patch) | |
tree | 14e337c2027f01206afa0731e0dcc35c0eca0cc9 | |
parent | 77bb543a3294b6bc69a308de623892aec55a227b (diff) |
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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19511 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/packet-fcp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-iscsi.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-ndmp.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-scsi.h | 3 |
5 files changed, 19 insertions, 7 deletions
diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c index fba82f69ce..6f357d67ee 100644 --- a/epan/dissectors/packet-fcp.c +++ b/epan/dissectors/packet-fcp.c @@ -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 */ diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index 8668189219..853d713838 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -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){ diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index ee2f0f5187..130949de39 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -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; } diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c index 1623efe971..d3d47dd024 100644 --- a/epan/dissectors/packet-scsi.c +++ b/epan/dissectors/packet-scsi.c @@ -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; diff --git a/epan/dissectors/packet-scsi.h b/epan/dissectors/packet-scsi.h index 5edd08343b..c9afc9c7f8 100644 --- a/epan/dissectors/packet-scsi.h +++ b/epan/dissectors/packet-scsi.h @@ -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[]; |