From Mark Burton: reinstate data segment digest handling, and stop the
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 16 Jan 2002 20:25:07 +0000 (20:25 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 16 Jan 2002 20:25:07 +0000 (20:25 +0000)
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
packet-scsi.c

index 668068ebdeb8acd0f2e122ebe6b56ea6a6dd32d1..5906441fb7c49cfb9172a4388033f0cdcc8f1f42 100644 (file)
@@ -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 <gerald@ethereal.com>
@@ -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 */
index a77fb8f0e90a48fa303ac55dd05ee5821f6af56e..c9e115f9d5d4bf29b49c6406779f9895dbe1c59c 100644 (file)
@@ -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 <gerald@ethereal.com>
@@ -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");