Ethereal-dev: Re: [Ethereal-dev] patch to update iscsi support

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Bill Studenmund <wrstuden@xxxxxxxxxxxxxxxxx>
Date: Mon, 13 May 2002 17:28:22 -0700 (PDT)
On Mon, 13 May 2002, Mark Burton wrote:

> I notice this patch removes support for dissecting the CRN field. I
> would be happier if this was not applied because packet-iscsi.c needs
> to support multiple versions of the iSCSI protocol through the magic
> of conditional compilation. I am sure that a lot of people are still
> using initiators/targets based on earlier versions of the protocol.

Ok, how's this? I've not really tested DRAFT08 or DRAFT09 support, but
it's a copy&paste change. :-)

Take care,

Bill
--- packet-iscsi.c.orig	Wed Mar 20 17:41:13 2002
+++ packet-iscsi.c	Mon May 13 17:16:50 2002
@@ -101,7 +101,9 @@
 static int hf_iscsi_SCSICommand_R = -1;
 static int hf_iscsi_SCSICommand_W = -1;
 static int hf_iscsi_SCSICommand_Attr = -1;
+#if defined(DRAFT08) || defined(DRAFT09)
 static int hf_iscsi_SCSICommand_CRN = -1;
+#endif
 static int hf_iscsi_SCSICommand_AddCDB = -1;
 static int hf_iscsi_DataSegmentLength = -1;
 static int hf_iscsi_TotalAHSLength = -1;
@@ -123,6 +125,9 @@
 static int hf_iscsi_SCSIResponse_Status = -1;
 static int hf_iscsi_SenseLength = -1;
 static int hf_iscsi_SCSIData_F = -1;
+#if !defined(DRAFT08) && !defined(DRAFT09)
+static int hf_iscsi_SCSIData_A = -1;
+#endif
 static int hf_iscsi_SCSIData_S = -1;
 static int hf_iscsi_SCSIData_O = -1;
 static int hf_iscsi_SCSIData_U = -1;
@@ -244,6 +249,9 @@
 #define ISCSI_SCSI_DATA_FLAG_S 0x01
 #define ISCSI_SCSI_DATA_FLAG_U 0x02
 #define ISCSI_SCSI_DATA_FLAG_O 0x04
+#if !defined(DRAFT08) && !defined(DRAFT09)
+#define ISCSI_SCSI_DATA_FLAG_A 0x40
+#endif
 #define ISCSI_SCSI_DATA_FLAG_F 0x80
 
 static const value_string iscsi_opcodes[] = {
@@ -293,6 +301,13 @@
     "Not final PDU in sequence"
 };
 
+#if !defined(DRAFT08) && !defined(DRAFT09)
+static const true_false_string iscsi_meaning_A = {
+    "Request positive data ACK",
+    "No data ACK request"
+};
+#endif
+
 static const true_false_string iscsi_meaning_T = {
     "Transit to next login stage",
     "Stay in current login stage"
@@ -926,7 +941,9 @@
 		proto_tree_add_boolean(tt, hf_iscsi_SCSICommand_W, tvb, offset + 1, 1, b);
 		proto_tree_add_uint(tt, hf_iscsi_SCSICommand_Attr, tvb, offset + 1, 1, b);
 	    }
+#if defined(DRAFT08) || defined(DRAFT09)
 	    proto_tree_add_item(ti, hf_iscsi_SCSICommand_CRN, tvb, offset + 3, 1, FALSE);
+#endif
 	    proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, FALSE);
 	    proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, data_segment_len);
 	    proto_tree_add_item(ti, hf_iscsi_LUN, tvb, offset + 8, 8, FALSE);
@@ -1214,6 +1231,9 @@
 		proto_tree *tt = proto_item_add_subtree(tf, ett_iscsi_Flags);
 
 		proto_tree_add_boolean(tt, hf_iscsi_SCSIData_F, tvb, offset + 1, 1, b);
+#if !defined(DRAFT08) && !defined(DRAFT09)
+		proto_tree_add_boolean(tt, hf_iscsi_SCSIData_A, tvb, offset + 1, 1, b);
+#endif
 		proto_tree_add_boolean(tt, hf_iscsi_SCSIData_O, tvb, offset + 1, 1, b);
 		proto_tree_add_boolean(tt, hf_iscsi_SCSIData_U, tvb, offset + 1, 1, b);
 		proto_tree_add_boolean(tt, hf_iscsi_SCSIData_S, tvb, offset + 1, 1, b);
@@ -1663,11 +1683,13 @@
 	    FT_UINT8, BASE_HEX, VALS(iscsi_scsicommand_taskattrs), 0x07,          
 	    "SCSI task attributes", HFILL }
 	},
+#if defined(DRAFT08) || defined(DRAFT09)
 	{ &hf_iscsi_SCSICommand_CRN,
 	  { "CRN", "iscsi.scsicommand.crn",
 	    FT_UINT8, BASE_HEX, NULL, 0,          
 	    "SCSI command reference number", HFILL }
 	},
+#endif
 	{ &hf_iscsi_SCSICommand_AddCDB,
 	  { "AddCDB", "iscsi.scsicommand.addcdb",
 	    FT_UINT8, BASE_HEX, NULL, 0,
@@ -1773,6 +1795,13 @@
 	    FT_BOOLEAN, 8, TFS(&iscsi_meaning_F), ISCSI_SCSI_DATA_FLAG_F,
 	    "Final PDU", HFILL }
 	},
+#if !defined(DRAFT08) && !defined(DRAFT09)
+	{ &hf_iscsi_SCSIData_A,
+	  { "A", "iscsi.scsidata.A",
+	    FT_BOOLEAN, 8, TFS(&iscsi_meaning_A), ISCSI_SCSI_DATA_FLAG_A,
+	    "Data Ack Req", HFILL }
+	},
+#endif
 	{ &hf_iscsi_SCSIData_S,
 	  { "S", "iscsi.scsidata.S",
 	    FT_BOOLEAN, 8, TFS(&iscsi_meaning_S), ISCSI_SCSI_DATA_FLAG_S,