Wireshark-dev: [Wireshark-dev] A patch for SCSI dissection
From: Richard Sharpe <[email protected]>
Date: Thu, 2 Dec 2010 18:30:51 -0800
Hi,

I got sick of not being able to search on the parameter list in a
PERSISTENT RESERVE OUT request so I hacked up a quick fix.

It is below. It still requires some work, as I need to preserve the
SERVICE ACTION between CDB processing and PAYLOAD processing ... so it
is still a work in progress:

--- wireshark-1.4.2/epan/dissectors/packet-scsi.c       2010-11-18
13:30:36.000000000 -0800
+++ wireshark-1.4.2-dev/epan/dissectors/packet-scsi.c   2010-12-02
18:22:55.000000000 -0800
@@ -125,6 +125,10 @@ static int hf_scsi_mmcpagecode
 static int hf_scsi_modesns_flags         = -1;
 static int hf_scsi_persresvin_svcaction  = -1;
 static int hf_scsi_persresvout_svcaction = -1;
+static int hf_scsi_persresvout_reskey    = -1;
+static int hf_scsi_persresvout_sareskey  = -1;
+static int hf_scsi_persresvout_obsolete  = -1;
+static int hf_scsi_persresvout_control   = -1;
 static int hf_scsi_persresv_scope        = -1;
 static int hf_scsi_persresv_type         = -1;
 static int hf_scsi_release_flags         = -1;
@@ -3942,6 +3946,23 @@ dissect_spc_persistentreserveout (tvbuff
                                     "Vendor Unique = %u, NACA = %u, Link = %u",
                                     flags & 0xC0, flags & 0x4, flags & 0x1);
     }
+    else if (isreq && !iscdb) {
+       /*
+        * To do this properly we need the svcaction passed between the above
+        * code and us ... TODO
+        */
+        proto_tree_add_bytes (tree, hf_scsi_persresvout_reskey, tvb, offset,
+                             8, tvb_get_ptr(tvb, 0, 8));
+       proto_tree_add_bytes (tree, hf_scsi_persresvout_sareskey, tvb,
+                             offset +8, 8, tvb_get_ptr(tvb, offset + 8, 8));
+       proto_tree_add_bytes (tree, hf_scsi_persresvout_obsolete, tvb,
+                             offset + 16, 4, tvb_get_ptr(tvb, offset + 16, 4));
+       flags = tvb_get_guint8 (tvb, offset + 20);
+       proto_tree_add_uint_format (tree, hf_scsi_persresvout_control, tvb,
+                             offset + 20, 1, flags,
+                             "SPEC_I_PT = %u, ALL_TG_PT = %u, APTPL = %u",
+                             flags & 0x08, flags & 0x04, flags &0x01);
+    }
     else {
     }
 }
@@ -5069,6 +5090,18 @@ proto_register_scsi (void)
         { &hf_scsi_persresv_type,
           {"Reservation Type", "scsi.persresv.type", FT_UINT8, BASE_HEX,
            VALS (scsi_persresv_type_val), 0x0F, NULL, HFILL}},
+       { &hf_scsi_persresvout_reskey,
+         {"Reservation Key", "scsi.persresv.reskey", FT_BYTES, BASE_NONE,
+          NULL, 0x0, NULL, HFILL}},
+       { &hf_scsi_persresvout_sareskey,
+         {"Service Action Reservation Key", "scsi.persresv.sareskey", FT_BYTES,
+          BASE_NONE, NULL, 0x0, NULL, HFILL}},
+       { &hf_scsi_persresvout_obsolete,
+         {"Obsolete", "scsi.presresv.obs", FT_BYTES, BASE_NONE, NULL, 0x0,
+          NULL, HFILL}},
+       { &hf_scsi_persresvout_control,
+         {"Control", "scsi.persresv.control", FT_UINT8, BASE_HEX, NULL, 0x0,
+          NULL, HFILL}},
         { &hf_scsi_release_flags,
           {"Release Flags", "scsi.release.flags", FT_UINT8, BASE_HEX, NULL,
            0x0, NULL, HFILL}},


-- 
Regards,
Richard Sharpe