From 6314c45d7628a949f9942514bf2e5d1aa1de12bf Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 16 Jan 2002 20:25:07 +0000 Subject: [PATCH] From Mark Burton: reinstate data segment digest handling, and stop the SCSI dissector from treating data digests as payload. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4552 f5534014-38df-0310-8fa8-9805f1628bb7 --- packet-iscsi.c | 14 +++++++++++++- packet-scsi.c | 8 ++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packet-iscsi.c b/packet-iscsi.c index 668068ebde..5906441fb7 100644 --- a/packet-iscsi.c +++ b/packet-iscsi.c @@ -4,7 +4,7 @@ * * Conforms to the protocol described in: draft-ietf-ips-iscsi-08.txt * - * $Id: packet-iscsi.c,v 1.19 2002/01/10 01:28:43 guy Exp $ + * $Id: packet-iscsi.c,v 1.20 2002/01/16 20:25:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -669,6 +669,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off conversation_t *conversation = NULL; iscsi_conv_data_t *cdata = NULL; iscsi_conv_key_t ckey, *req_key; + int paddedDataSegmentLength = data_segment_len; + if(paddedDataSegmentLength & 3) + paddedDataSegmentLength += 4 - (paddedDataSegmentLength & 3); /* Make entries in Protocol column and Info column on summary display */ if (check_col(pinfo->cinfo, COL_PROTOCOL)) @@ -861,6 +864,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off proto_tree_add_item(ti, hf_iscsi_ExpDataSN, tvb, offset + 36, 4, FALSE); proto_tree_add_item(ti, hf_iscsi_SCSIResponse_BidiReadResidualCount, tvb, offset + 44, 4, FALSE); offset = handleHeaderDigest(ti, tvb, offset, 48); + /* do not update offset here because the data segment is + * dissected below */ + handleDataDigest(ti, tvb, offset, paddedDataSegmentLength); } else if(opcode == ISCSI_OPCODE_TASK_MANAGEMENT_FUNCTION) { /* Task Management Function */ @@ -1003,6 +1009,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off 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); offset = handleHeaderDigest(ti, tvb, offset, 48); + /* do not update offset here because the data segment is + * dissected below */ + handleDataDigest(ti, tvb, offset, paddedDataSegmentLength); } else if(opcode == ISCSI_OPCODE_SCSI_DATA_IN) { /* SCSI Data In (read) */ @@ -1026,6 +1035,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off 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); offset = handleHeaderDigest(ti, tvb, offset, 48); + /* do not update offset here because the data segment is + * dissected below */ + handleDataDigest(ti, tvb, offset, paddedDataSegmentLength); } else if(opcode == ISCSI_OPCODE_LOGOUT_COMMAND) { /* Logout Command */ diff --git a/packet-scsi.c b/packet-scsi.c index a77fb8f0e9..c9e115f9d5 100644 --- a/packet-scsi.c +++ b/packet-scsi.c @@ -2,7 +2,7 @@ * Routines for decoding SCSI CDBs and responses * Author: Dinesh G Dutt (ddutt@cisco.com) * - * $Id: packet-scsi.c,v 1.1 2002/01/10 01:28:43 guy Exp $ + * $Id: packet-scsi.c,v 1.2 2002/01/16 20:25:07 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -2055,7 +2055,7 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (tree) { if (cmd == SCSI_CMND_SPC2) { ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, offset, - tvb_length (tvb), + payload_len, "SCSI Payload (%s %s)", val_to_str (opcode, scsi_spc2_val, @@ -2064,7 +2064,7 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else if (cmd == SCSI_CMND_SBC2) { ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, offset, - tvb_length (tvb), + payload_len, "SCSI Payload (%s %s)", val_to_str (opcode, scsi_sbc2_val, @@ -2073,7 +2073,7 @@ dissect_scsi_payload (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } else { ti = proto_tree_add_protocol_format (tree, proto_scsi, tvb, offset, - tvb_length (tvb), + payload_len, "SCSI Payload (0x%02x %s)", opcode, isreq ? "Request" : "Response"); -- 2.34.1