Ethereal-dev: [Ethereal-dev] Some more patches for FC-SP

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

From: Dinesh G Dutt <ddutt@xxxxxxxxx>
Date: Thu, 6 Nov 2003 23:36:25 -0800
Hi,

I'm including 3 patches related to FC-SP:
    - Added support for decoding related to Security in *LOGI service params
    - Added support for new LS_RJT code for authentication failure
    - Brought packet-fcsp.c up-to-date with FC-SP rev 1.2

I made some mods to FC-ELS decoder:
    - Added support for displaying support for Multicast/Broadcast supported
      bits in *LOGI common service params
    - Removed restriction for "Random Relative Offset" & its alternate to be in
      PLOGI or PDISC only. Some HBAs set it even in FLOGI. 

Dinesh
--
Index: packet-fcels.c
===================================================================
RCS file: /cvsroot/ethereal/packet-fcels.c,v
retrieving revision 1.5
diff -u -r1.5 packet-fcels.c
--- packet-fcels.c	30 Oct 2003 02:06:11 -0000	1.5
+++ packet-fcels.c	7 Nov 2003 07:30:32 -0000
@@ -244,17 +244,15 @@
 
     punc[0] = '\0';
     
-    if ((opcode == FC_ELS_PLOGI) || (opcode == FC_ELS_PDISC)) {
-        if (flag & 0x8000) {
-            strcpy (flagstr, "Cont. Incr. Offset Supported");
-            stroff += 28;
-            strcpy (punc, ", ");
-        }
-        if (flag & 0x4000) {
-            sprintf (&flagstr[stroff], "%sRRO Supported", punc);
-            stroff += 15;
-            strcpy (punc, ", ");
-        }
+    if (flag & 0x8000) {
+        strcpy (flagstr, "Cont. Incr. Offset Supported");
+        stroff += 28;
+        strcpy (punc, ", ");
+    }
+    if (flag & 0x4000) {
+        sprintf (&flagstr[stroff], "%sRRO Supported", punc);
+        stroff += 15;
+        strcpy (punc, ", ");
     }
     
     if (flag & 0x2000) {
@@ -271,7 +269,7 @@
     else {
         sprintf (&flagstr[stroff], "%sNormal B2B Credit Mgmt", punc);
         strcpy (punc, ", ");
-        stroff += 21;
+        stroff += 22;
     }
 
     if ((opcode == FC_ELS_PLOGI) || (opcode == FC_ELS_PDISC)) {
@@ -287,6 +285,21 @@
             strcpy (&flagstr[stroff], ", Simplex Dedicated Conn Supported");
             stroff += 34;
         }
+    }
+
+    if (flag & 0x0200) {
+        strcpy (&flagstr[stroff], ", Multicast Supported");
+        stroff += 21;
+    }
+    
+    if (flag & 0x0100) {
+        strcpy (&flagstr[stroff], ", Broadcast Supported");
+        stroff += 21;
+    }
+
+    if (flag & 0x0020) {
+        strcpy (&flagstr[stroff], ", Security Bit");
+        stroff += 14;
     }
     
     if (flag & 0x0010) {

Index: packet-fcels.h
===================================================================
RCS file: /cvsroot/ethereal/packet-fcels.h,v
retrieving revision 1.2
diff -u -r1.2 packet-fcels.h
--- packet-fcels.h	30 Oct 2003 02:06:11 -0000	1.2
+++ packet-fcels.h	7 Nov 2003 07:30:41 -0000
@@ -155,6 +155,7 @@
 #define FC_ELS_RJT_DET_INV_VCID          0x41
 #define FC_ELS_RJT_DET_OORSRC_C4         0x42
 #define FC_ELS_RJT_DET_INV_PNNAME        0x44
+#define FC_ELS_RJT_DET_AUTH_REQD         0x48
 
 static const value_string fc_els_rjt_det_val[] = {
     {FC_ELS_RJT_DET_NODET            , "No further details"},
@@ -195,6 +196,8 @@
     {FC_ELS_RJT_DET_INV_VCID         , "VC_ID Not Found"},
     {FC_ELS_RJT_DET_OORSRC_C4        , "No Resources to Support Class 4 Conn"},
     {FC_ELS_RJT_DET_INV_PNNAME       , "Invalid Port/Node Name"},
+    {FC_ELS_RJT_DET_AUTH_REQD        , "Authentication Required"},
+    {0, NULL},
 };
 
 static const value_string fc_els_flacompliance_val[] = {

Index: packet-fcsp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-fcsp.c,v
retrieving revision 1.1
diff -u -r1.1 packet-fcsp.c
--- packet-fcsp.c	30 Oct 2003 02:06:12 -0000	1.1
+++ packet-fcsp.c	7 Nov 2003 07:31:07 -0000
@@ -174,10 +174,7 @@
     guint16 param_len = 0, i;
     
     if (tree) {
-        proto_tree_add_item (tree, hf_auth_proto_type, tvb, offset, 4, 0);
-
-        auth_param_tag = tvb_get_ntohs (tvb, offset+4);
-        offset += 4;
+        auth_param_tag = tvb_get_ntohs (tvb, offset);
         total_len -= 4;
         
         while (total_len > 0) {
@@ -187,7 +184,7 @@
                                  2, 0);
 
             auth_param_tag = tvb_get_ntohs (tvb, offset);
-            param_len = tvb_get_ntohs (tvb, offset+2);
+            param_len = tvb_get_ntohs (tvb, offset+2)*4;
 
             switch (auth_param_tag) {
             case FC_AUTH_DHCHAP_PARAM_HASHLIST:
@@ -347,12 +344,14 @@
         offset += 4;
         
         for (i = 0; i < num_protos; i++) {
-            proto_type = tvb_get_ntohs (tvb, offset);
-            proto_tree_add_item (tree, hf_auth_proto_type, tvb, offset, 2, 0);
-            proto_tree_add_item (tree, hf_auth_proto_param_len, tvb, offset+2, 2, 0);
-            param_len = tvb_get_ntohs (tvb, offset+2)*4;
-
+            proto_tree_add_item (tree, hf_auth_proto_param_len, tvb, offset, 4, 0);
+            param_len = tvb_get_ntohl (tvb, offset);
+            offset += 4;
+            
             if (tvb_bytes_exist (tvb, offset, param_len)) {
+                proto_type = tvb_get_ntohl (tvb, offset);
+
+                proto_tree_add_item (tree, hf_auth_proto_type, tvb, offset, 4, 0);
                 switch (proto_type) {
                 case FC_AUTH_PROTO_TYPE_DHCHAP:
                     dissect_fcsp_dhchap_auth_param (tvb, tree, offset+4, param_len);
-- 
When you were born, you cried and the world rejoiced. Live your life so when
you die, the world cries and you rejoice. - Indian saying