Use MAC address documentation range in filter examples
[metze/wireshark/wip.git] / epan / dissectors / packet-fcswils.c
index e01b83c82ce5793690655484954bfe370f257a30..81a11dcd2fc8ee3ccbfa4fdb5696213e2991aa48 100644 (file)
@@ -123,6 +123,9 @@ static int hf_swils_zone_objtype          = -1;
 static int hf_swils_zone_mbrtype          = -1;
 static int hf_swils_zone_protocol         = -1;
 static int hf_swils_zone_mbrid            = -1;
+static int hf_swils_zone_mbrid_fcwwn      = -1;
+static int hf_swils_zone_mbrid_fc         = -1;
+static int hf_swils_zone_mbrid_uint       = -1;
 static int hf_swils_zone_status           = -1;
 static int hf_swils_zone_reason           = -1;
 static int hf_swils_aca_domainid          = -1;
@@ -202,6 +205,7 @@ static int hf_swils_lsupdate_flags = -1;
 
 static expert_field ei_swils_efp_record_len = EI_INIT;
 static expert_field ei_swils_no_exchange = EI_INIT;
+static expert_field ei_swils_zone_mbrid = EI_INIT;
 
 /* Initialize the subtree pointers */
 static gint ett_fcswils             = -1;
@@ -482,11 +486,13 @@ fcswils_hash(gconstpointer v)
 static void
 fcswils_init_protocol(void)
 {
-    if (fcswils_req_hash)
-        g_hash_table_destroy(fcswils_req_hash);
-
     fcswils_req_hash = g_hash_table_new(fcswils_hash, fcswils_equal);
+}
 
+static void
+fcswils_cleanup_protocol(void)
+{
+    g_hash_table_destroy(fcswils_req_hash);
 }
 
 static guint8 *
@@ -720,39 +726,36 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
 {
 
     /* Set up structures needed to add the protocol subtree and manage it */
-    int          offset = 0;
-    const gchar *flags;
-    fcswils_elp  elp;
-
     /* Response i.e. SW_ACC for an ELP has the same format as the request */
     /* We skip the initial 4 bytes as we don't care about the opcode */
-    tvb_memcpy(tvb, (guint8 *)&elp, 4, FC_SWILS_ELP_SIZE);
-
-    elp.r_a_tov = g_ntohl(elp.r_a_tov);
-    elp.e_d_tov = g_ntohl(elp.e_d_tov);
-    elp.isl_flwctrl_mode = g_ntohs(elp.isl_flwctrl_mode);
-    elp.flw_ctrl_parmlen = g_ntohs(elp.flw_ctrl_parmlen);
+    int          offset = 4;
+    const gchar *flags;
+    guint32 r_a_tov;
+    guint32 e_d_tov;
+    guint16 isl_flwctrl_mode;
+    guint8  clsf_svcparm[6], cls1_svcparm[2], cls2_svcparm[2], cls3_svcparm[2];
 
     if (elp_tree) {
         offset += 4;
         proto_tree_add_item(elp_tree, hf_swils_elp_rev, tvb, offset++, 1, ENC_BIG_ENDIAN);
         proto_tree_add_item(elp_tree, hf_swils_elp_flags, tvb, offset, 2, ENC_NA);
         offset += 3;
+        r_a_tov = tvb_get_ntohl(tvb, offset);
         proto_tree_add_uint_format_value(elp_tree, hf_swils_elp_r_a_tov, tvb, offset, 4,
-                                   elp.r_a_tov, "%d msecs", elp.r_a_tov);
+                                   r_a_tov, "%d msecs", r_a_tov);
         offset += 4;
+        e_d_tov = tvb_get_ntohl(tvb, offset);
         proto_tree_add_uint_format_value(elp_tree, hf_swils_elp_e_d_tov, tvb, offset, 4,
-                                   elp.e_d_tov, "%d msecs", elp.e_d_tov);
+                                   e_d_tov, "%d msecs", e_d_tov);
         offset += 4;
-        proto_tree_add_string(elp_tree, hf_swils_elp_req_epn, tvb, offset, 8,
-                              fcwwn_to_str(elp.req_epname));
+        proto_tree_add_item(elp_tree, hf_swils_elp_req_epn, tvb, offset, 8, ENC_NA);
         offset += 8;
-        proto_tree_add_string(elp_tree, hf_swils_elp_req_esn, tvb, offset, 8,
-                              fcwwn_to_str(elp.req_sname));
+        proto_tree_add_item(elp_tree, hf_swils_elp_req_esn, tvb, offset, 8, ENC_NA);
         offset += 8;
 
-        if (elp.clsf_svcparm[0] & 0x80) {
-            if (elp.clsf_svcparm[4] & 0x20) {
+        tvb_memcpy(tvb, clsf_svcparm, offset, 6);
+        if (clsf_svcparm[0] & 0x80) {
+            if (clsf_svcparm[4] & 0x20) {
                 flags="Class F Valid | X_ID Interlock";
             } else {
                 flags="Class F Valid | No X_ID Interlk";
@@ -761,7 +764,7 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
             flags="Class F Invld";
         }
         proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_clsf_svcp, tvb, offset, 6,
-                                    &elp.clsf_svcparm[0], "(%s)", flags);
+                                    clsf_svcparm, "(%s)", flags);
         offset += 6;
 
         proto_tree_add_item(elp_tree, hf_swils_elp_clsf_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -773,7 +776,8 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
         proto_tree_add_item(elp_tree, hf_swils_elp_clsf_openseq, tvb, offset, 2, ENC_BIG_ENDIAN);
         offset += 4;
 
-        if (elp.cls1_svcparm[0] & 0x80) {
+        tvb_memcpy(tvb, cls1_svcparm, offset, 2);
+        if (cls1_svcparm[0] & 0x80) {
 #define MAX_FLAGS_LEN 40
             char *flagsbuf;
             gint stroff, returned_length;
@@ -784,15 +788,15 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
             returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff,
                                          "Class 1 Valid");
             stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
-            if (elp.cls1_svcparm[0] & 0x40) {
+            if (cls1_svcparm[0] & 0x40) {
                 returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IMX");
                 stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
             }
-            if (elp.cls1_svcparm[0] & 0x20) {
+            if (cls1_svcparm[0] & 0x20) {
                 returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | IPS");
                 stroff += MIN(returned_length, MAX_FLAGS_LEN-stroff);
             }
-            if (elp.cls1_svcparm[0] & 0x10) {
+            if (cls1_svcparm[0] & 0x10) {
                 /*returned_length =*/ g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, " | LKS");
             }
             flags=flagsbuf;
@@ -804,13 +808,14 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
         proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls1_svcp, tvb, offset, 2,
                                     NULL, "(%s)", flags);
         offset += 2;
-        if (elp.cls1_svcparm[0] & 0x80) {
+        if (cls1_svcparm[0] & 0x80) {
             proto_tree_add_item(elp_tree, hf_swils_elp_cls1_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
         }
         offset += 2;
 
-        if (elp.cls2_svcparm[0] & 0x80) {
-            if (elp.cls2_svcparm[0] & 0x08) {
+        tvb_memcpy(tvb, cls2_svcparm, offset, 2);
+        if (cls2_svcparm[0] & 0x80) {
+            if (cls2_svcparm[0] & 0x08) {
                 flags="Class 2 Valid | Seq Delivery";
             }
             else {
@@ -822,17 +827,18 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
         }
 
         proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls2_svcp, tvb, offset, 2,
-                                    &elp.cls2_svcparm[0],
+                                    cls2_svcparm,
                                     "(%s)", flags);
         offset += 2;
 
-        if (elp.cls2_svcparm[0] & 0x80) {
+        if (cls2_svcparm[0] & 0x80) {
             proto_tree_add_item(elp_tree, hf_swils_elp_cls2_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
         }
         offset += 2;
 
-        if (elp.cls3_svcparm[0] & 0x80) {
-            if (elp.cls3_svcparm[0] & 0x08) {
+        tvb_memcpy(tvb, cls3_svcparm, offset, 2);
+        if (cls3_svcparm[0] & 0x80) {
+            if (cls3_svcparm[0] & 0x08) {
                 flags="Class 3 Valid | Seq Delivery";
             }
             else {
@@ -843,17 +849,18 @@ dissect_swils_elp(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *elp_tree, g
             flags="Class 3 Invld";
         }
         proto_tree_add_bytes_format_value(elp_tree, hf_swils_elp_cls3_svcp, tvb, offset, 2,
-                                    &elp.cls3_svcparm[0],
+                                    cls3_svcparm,
                                     "(%s)", flags);
         offset += 2;
 
-        if (elp.cls3_svcparm[0] & 0x80) {
+        if (cls3_svcparm[0] & 0x80) {
             proto_tree_add_item(elp_tree, hf_swils_elp_cls3_rcvsz, tvb, offset, 2, ENC_BIG_ENDIAN);
         }
         offset += 22;
 
+        isl_flwctrl_mode = tvb_get_ntohs(tvb, offset);
         proto_tree_add_string(elp_tree, hf_swils_elp_isl_fc_mode, tvb, offset, 2,
-                              val_to_str_const(elp.isl_flwctrl_mode, fcswils_elp_fc_val, "Vendor Unique"));
+                              val_to_str_const(isl_flwctrl_mode, fcswils_elp_fc_val, "Vendor Unique"));
         offset += 2;
         proto_tree_add_item(elp_tree, hf_swils_elp_fcplen, tvb, offset, 2, ENC_BIG_ENDIAN);
         offset += 2;
@@ -878,20 +885,20 @@ dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint
     proto_tree  *lrec_tree;
     proto_item  *rec_item;
     int          num_listrec = 0;
-    int          offset      = 0;
-    fcswils_efp  efp;
+    int          offset      = 1; /* Skip opcode */
+    guint8       reclen;
+    guint16      payload_len;
     guint8       rec_type;
 
+    reclen = tvb_get_guint8(tvb, offset);
+    rec_item = proto_tree_add_uint(efp_tree, hf_swils_efp_record_len, tvb, offset, 1, reclen);
     offset += 1;
-    efp.reclen = tvb_get_guint8(tvb, offset);
-    rec_item = proto_tree_add_uint(efp_tree, hf_swils_efp_record_len, tvb, offset, 1, efp.reclen);
-    offset += 1;
-    efp.payload_len = tvb_get_ntohs(tvb, offset);
-    if (efp.payload_len < FC_SWILS_EFP_SIZE) {
+    payload_len = tvb_get_ntohs(tvb, offset);
+    if (payload_len < FC_SWILS_EFP_SIZE) {
         proto_tree_add_uint_format_value(efp_tree, hf_swils_efp_payload_len,
-                                       tvb, offset, 2, efp.payload_len,
+                                       tvb, offset, 2, payload_len,
                                        "%u (bogus, must be >= %u)",
-                                       efp.payload_len, FC_SWILS_EFP_SIZE);
+                                       payload_len, FC_SWILS_EFP_SIZE);
         return;
     }
     proto_tree_add_item(efp_tree, hf_swils_efp_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN);
@@ -899,18 +906,16 @@ dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint
     proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_pri, tvb,
                             offset, 1, ENC_BIG_ENDIAN);
     offset += 1;
-    tvb_memcpy(tvb, efp.pswitch_name, offset, 8);
-    proto_tree_add_string(efp_tree, hf_swils_efp_pswitch_name, tvb, offset,
-                              8, fcwwn_to_str(efp.pswitch_name));
+    proto_tree_add_item(efp_tree, hf_swils_efp_pswitch_name, tvb, offset, 8, ENC_NA);
     offset += 8;
 
-    if (efp.reclen == 0) {
+    if (reclen == 0) {
         expert_add_info(pinfo, rec_item, &ei_swils_efp_record_len);
         return;
     }
     /* Add List Records now */
     if (efp_tree) {
-        num_listrec = (efp.payload_len - FC_SWILS_EFP_SIZE)/efp.reclen;
+        num_listrec = (payload_len - FC_SWILS_EFP_SIZE)/reclen;
         while (num_listrec-- > 0) {
             rec_type = tvb_get_guint8(tvb, offset);
             lrec_tree = proto_tree_add_subtree(efp_tree, tvb, offset, -1,
@@ -924,15 +929,14 @@ dissect_swils_efp(tvbuff_t *tvb, packet_info* pinfo, proto_tree *efp_tree, guint
 
             case FC_SWILS_LRECTYPE_DOMAIN:
                 proto_tree_add_item(lrec_tree, hf_swils_efp_dom_id, tvb, offset+1, 1, ENC_BIG_ENDIAN);
-                proto_tree_add_string(lrec_tree, hf_swils_efp_switch_name, tvb, offset+8, 8,
-                                      tvb_fcwwn_to_str(tvb, offset+8));
+                proto_tree_add_item(lrec_tree, hf_swils_efp_switch_name, tvb, offset+8, 8, ENC_NA);
                 break;
 
             case FC_SWILS_LRECTYPE_MCAST:
                 proto_tree_add_item(lrec_tree, hf_swils_efp_mcast_grpno, tvb, offset+1, 1, ENC_BIG_ENDIAN);
                 break;
             }
-            offset += efp.reclen;
+            offset += reclen;
         }
     }
 }
@@ -944,8 +948,8 @@ dissect_swils_dia(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *dia_tree, g
     int offset = 0;
 
     if (dia_tree) {
-        proto_tree_add_string(dia_tree, hf_swils_dia_switch_name, tvb, offset+4,
-                              8, tvb_fcwwn_to_str(tvb, offset+4));
+        proto_tree_add_item(dia_tree, hf_swils_dia_switch_name, tvb, offset+4,
+                              8, ENC_NA);
     }
 }
 
@@ -960,8 +964,7 @@ dissect_swils_rdi(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rdi_tree, g
         plen = tvb_get_ntohs(tvb, offset+2);
 
         proto_tree_add_item(rdi_tree, hf_swils_rdi_payload_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
-        proto_tree_add_string(rdi_tree, hf_swils_rdi_req_sname, tvb, offset+4,
-                              8, tvb_fcwwn_to_str(tvb, offset+4));
+        proto_tree_add_item(rdi_tree, hf_swils_rdi_req_sname, tvb, offset+4, 8, ENC_NA);
 
         /* 12 is the length of the initial header and 4 is the size of each
          * domain request record.
@@ -1019,8 +1022,7 @@ dissect_swils_fspf_lsrechdr(tvbuff_t *tvb, proto_tree *tree, int offset)
 static void
 dissect_swils_fspf_ldrec(tvbuff_t *tvb, proto_tree *tree, int offset)
 {
-    proto_tree_add_string(tree, hf_swils_ldrec_linkid, tvb, offset, 4,
-                          tvb_fc_to_str(tvb, offset+1));
+    proto_tree_add_item(tree, hf_swils_ldrec_linkid, tvb, offset+1, 3, ENC_NA);
     proto_tree_add_item(tree, hf_swils_ldrec_out_pidx, tvb, offset+5, 3, ENC_BIG_ENDIAN);
     proto_tree_add_item(tree, hf_swils_ldrec_nbr_pidx, tvb, offset+9, 3, ENC_BIG_ENDIAN);
     proto_tree_add_item(tree, hf_swils_ldrec_link_type, tvb, offset+12, 1, ENC_BIG_ENDIAN);
@@ -1141,8 +1143,8 @@ dissect_swils_rscn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rscn_tree,
                             1, ENC_BIG_ENDIAN);
         proto_tree_add_item(rscn_tree, hf_swils_rscn_addrfmt, tvb, offset+4,
                             1, ENC_BIG_ENDIAN);
-        proto_tree_add_string(rscn_tree, hf_swils_rscn_affectedport, tvb,
-                              offset+5, 3, tvb_fc_to_str(tvb, offset+5));
+        proto_tree_add_item(rscn_tree, hf_swils_rscn_affectedport, tvb,
+                              offset+5, 3, ENC_NA);
         proto_tree_add_item(rscn_tree, hf_swils_rscn_detectfn, tvb,
                             offset+8, 4, ENC_BIG_ENDIAN);
         numrec = tvb_get_ntohl(tvb, offset+12);
@@ -1160,12 +1162,9 @@ dissect_swils_rscn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rscn_tree,
                                         ett_fcswils_rscn_dev, NULL, "Device Entry %d", i);
 
             proto_tree_add_item(dev_tree, hf_swils_rscn_portstate, tvb, offset, 1, ENC_BIG_ENDIAN);
-            proto_tree_add_string(dev_tree, hf_swils_rscn_portid, tvb, offset+1, 3,
-                                  tvb_fc_to_str(tvb, offset+1));
-            proto_tree_add_string(dev_tree, hf_swils_rscn_pwwn, tvb, offset+4, 8,
-                                  tvb_fcwwn_to_str(tvb, offset+4));
-            proto_tree_add_string(dev_tree, hf_swils_rscn_nwwn, tvb, offset+12, 8,
-                                  tvb_fcwwn_to_str(tvb, offset+12));
+            proto_tree_add_item(dev_tree, hf_swils_rscn_portid, tvb, offset+1, 3, ENC_NA);
+            proto_tree_add_item(dev_tree, hf_swils_rscn_pwwn, tvb, offset+4, 8, ENC_NA);
+            proto_tree_add_item(dev_tree, hf_swils_rscn_nwwn, tvb, offset+12, 8, ENC_NA);
             offset += 20;
         }
     }
@@ -1186,71 +1185,61 @@ dissect_swils_rscn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *rscn_tree,
  */
 
 static void
-dissect_swils_zone_mbr(tvbuff_t *tvb, proto_tree *zmbr_tree, int offset)
+dissect_swils_zone_mbr(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zmbr_tree, int offset)
 {
     guint8  mbrtype;
     int     idlen;
-    char    dpbuf[2+8+1];
-    char   *str;
+    proto_item* ti;
 
     mbrtype = tvb_get_guint8(tvb, offset);
-    proto_tree_add_uint(zmbr_tree, hf_swils_zone_mbrtype, tvb,
+    ti = proto_tree_add_uint(zmbr_tree, hf_swils_zone_mbrtype, tvb,
                         offset, 1, mbrtype);
     proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrflags, tvb, offset+2, 1, ENC_BIG_ENDIAN);
     idlen = tvb_get_guint8(tvb, offset+3);
     proto_tree_add_item(zmbr_tree, hf_swils_zone_mbr_identifier_length, tvb, offset+3, 1, ENC_BIG_ENDIAN);
     switch (mbrtype) {
     case FC_SWILS_ZONEMBR_WWN:
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, 8,
-                              tvb_fcwwn_to_str(tvb, offset+4));
+        proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fcwwn, tvb,
+                              offset+4, 8, ENC_NA);
         break;
     case FC_SWILS_ZONEMBR_DP:
-        g_snprintf(dpbuf, sizeof(dpbuf), "0x%08x", tvb_get_ntohl(tvb, offset+4));
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, 4, dpbuf);
+        proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_uint, tvb,
+                              offset+4, 4, ENC_BIG_ENDIAN);
         break;
     case FC_SWILS_ZONEMBR_FCID:
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, 4,
-                              tvb_fc_to_str(tvb, offset+5));
+        proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fc, tvb,
+                              offset+4, 3, ENC_NA);
         break;
     case FC_SWILS_ZONEMBR_ALIAS:
-        str = zonenm_to_str(tvb, offset+4);
         proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, idlen, str);
+                              offset+4, idlen, zonenm_to_str(tvb, offset+4));
         break;
     case FC_SWILS_ZONEMBR_WWN_LUN:
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, 8,
-                              tvb_fcwwn_to_str(tvb, offset+4));
+        proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fcwwn, tvb,
+                              offset+4, 8, ENC_NA);
         proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_lun, tvb,
                             offset+12, 8, ENC_NA);
         break;
     case FC_SWILS_ZONEMBR_DP_LUN:
-        g_snprintf(dpbuf, sizeof(dpbuf), "0x%08x", tvb_get_ntohl(tvb, offset+4));
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, 4, dpbuf);
+        proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_uint, tvb,
+                              offset+4, 4, ENC_BIG_ENDIAN);
         proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_lun, tvb,
                             offset+8, 8, ENC_NA);
         break;
     case FC_SWILS_ZONEMBR_FCID_LUN:
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, 4,
-                              tvb_fc_to_str(tvb, offset+5));
+        proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_fc, tvb,
+                              offset+4, 3, ENC_NA);
         proto_tree_add_item(zmbr_tree, hf_swils_zone_mbrid_lun, tvb,
                             offset+8, 8, ENC_NA);
         break;
     default:
-        proto_tree_add_string(zmbr_tree, hf_swils_zone_mbrid, tvb,
-                              offset+4, idlen,
-                              "Unknown member type format");
+        expert_add_info(pinfo, ti, &ei_swils_zone_mbrid);
 
     }
 }
 
 static void
-dissect_swils_zone_obj(tvbuff_t *tvb, proto_tree *zobj_tree, int offset)
+dissect_swils_zone_obj(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zobj_tree, int offset)
 {
     proto_tree *zmbr_tree;
     int         mbrlen, numrec, i, objtype;
@@ -1272,21 +1261,21 @@ dissect_swils_zone_obj(tvbuff_t *tvb, proto_tree *zobj_tree, int offset)
     offset += 8 + ZONENAME_LEN(tvb, offset+4);
     for (i = 0; i < numrec; i++) {
         if (objtype == FC_SWILS_ZONEOBJ_ZONESET) {
-            dissect_swils_zone_obj(tvb, zobj_tree, offset);
+            dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
             offset += get_zoneobj_len(tvb, offset);
         }
         else {
             mbrlen = 4 + tvb_get_guint8(tvb, offset+3);
             zmbr_tree = proto_tree_add_subtree_format(zobj_tree, tvb, offset, mbrlen,
                                         ett_fcswils_zonembr, NULL, "Zone Member %d", i);
-            dissect_swils_zone_mbr(tvb, zmbr_tree, offset);
+            dissect_swils_zone_mbr(tvb, pinfo, zmbr_tree, offset);
             offset += mbrlen;
         }
     }
 }
 
 static void
-dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *mr_tree, guint8 isreq)
+dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo, proto_tree *mr_tree, guint8 isreq)
 {
     /* Set up structures needed to add the protocol subtree and manage it */
     int         offset = 0;
@@ -1294,7 +1283,6 @@ dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *mr_tre
     int         numrec, i, zonesetlen, objlistlen, objlen;
     char       *str;
 
-    if (mr_tree) {
         if (isreq) {
             /* zonesetlen is the size of the zoneset including the zone name */
             zonesetlen = tvb_get_ntohs(tvb, offset+2);
@@ -1322,7 +1310,7 @@ dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *mr_tre
                     objlen = get_zoneobj_len(tvb, offset);
                     zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset+4, objlen,
                                                 ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
-                    dissect_swils_zone_obj(tvb, zobj_tree, offset);
+                    dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
                     offset += objlen;
                 }
             }
@@ -1348,7 +1336,7 @@ dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *mr_tre
                     objlen = get_zoneobj_len(tvb, offset);
                     zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset,
                                                 objlen, ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
-                    dissect_swils_zone_obj(tvb, zobj_tree, offset);
+                    dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
                     offset += objlen;
                 }
             }
@@ -1360,7 +1348,6 @@ dissect_swils_mergereq(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *mr_tre
                                 offset+6, 1, ENC_BIG_ENDIAN);
             proto_tree_add_item(mr_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
         }
-    }
 }
 
 static void
@@ -1422,7 +1409,6 @@ dissect_swils_sfc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *sfc_tree, g
     int         numrec, i, zonesetlen, objlistlen, objlen;
     char       *str;
 
-    if (sfc_tree) {
         if (isreq) {
             proto_tree_add_item(sfc_tree, hf_swils_sfc_opcode, tvb, offset+1, 1, ENC_BIG_ENDIAN);
 
@@ -1451,7 +1437,7 @@ dissect_swils_sfc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *sfc_tree, g
                     objlen = get_zoneobj_len(tvb, offset);
                     zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset, objlen,
                                                 ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
-                    dissect_swils_zone_obj(tvb, zobj_tree, offset);
+                    dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
                     offset += objlen;
                 }
             }
@@ -1477,7 +1463,7 @@ dissect_swils_sfc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *sfc_tree, g
                     objlen = get_zoneobj_len(tvb, offset);
                     zobj_tree = proto_tree_add_subtree_format(zobjlist_tree, tvb, offset, objlen,
                                                 ett_fcswils_zoneobj, NULL, "Zone Object %d", i);
-                    dissect_swils_zone_obj(tvb, zobj_tree, offset);
+                    dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
                     offset += objlen;
                 }
             }
@@ -1489,7 +1475,6 @@ dissect_swils_sfc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *sfc_tree, g
                                 offset+6, 1, ENC_BIG_ENDIAN);
             proto_tree_add_item(sfc_tree, hf_swils_zone_vendor_unique, tvb, offset+7, 1, ENC_BIG_ENDIAN);
         }
-    }
 }
 
 static void
@@ -1820,7 +1805,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
         call_dissector(data_handle, next_tvb, pinfo, tree);
     }
 
-    return tvb_length(tvb);
+    return tvb_captured_length(tvb);
 }
 
 /* Register the protocol with Wireshark */
@@ -1856,12 +1841,12 @@ proto_register_fcswils(void)
 
         { &hf_swils_elp_req_epn,
           {"Req Eport Name", "swils.elp.reqepn",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_elp_req_esn,
           {"Req Switch Name", "swils.elp.reqesn",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_elp_clsf_svcp,
@@ -1966,7 +1951,7 @@ proto_register_fcswils(void)
 
         { &hf_swils_efp_switch_name,
           {"Switch Name", "swils.efp.sname",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_efp_mcast_grpno,
@@ -1998,12 +1983,12 @@ proto_register_fcswils(void)
 
         { &hf_swils_efp_pswitch_name,
           {"Principal Switch Name", "swils.efp.psname",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_dia_switch_name,
           {"Switch Name", "swils.dia.sname",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_rdi_payload_len,
@@ -2013,7 +1998,7 @@ proto_register_fcswils(void)
 
         { &hf_swils_rdi_req_sname,
           {"Req Switch Name", "swils.rdi.reqsn",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
 #if 0
@@ -2095,7 +2080,7 @@ proto_register_fcswils(void)
 
         { &hf_swils_ldrec_linkid,
           {"Link ID", "swils.ldr.linkid",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_BYTES, SEP_DOT, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_ldrec_out_pidx,
@@ -2130,7 +2115,7 @@ proto_register_fcswils(void)
 
         { &hf_swils_rscn_affectedport,
           {"Affected Port ID", "swils.rscn.affectedport",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_BYTES, SEP_DOT, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_rscn_detectfn,
@@ -2145,17 +2130,17 @@ proto_register_fcswils(void)
 
         { &hf_swils_rscn_portid,
           {"Port Id", "swils.rscn.portid",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_BYTES, SEP_DOT, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_rscn_pwwn,
           {"Port WWN", "swils.rscn.pwwn",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_rscn_nwwn,
           {"Node WWN", "swils.rscn.nwwn",
-           FT_STRING, BASE_NONE, NULL, 0x0,
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
         { &hf_swils_esc_swvendorid,
@@ -2203,6 +2188,21 @@ proto_register_fcswils(void)
            FT_STRING, BASE_NONE, NULL, 0x0,
            NULL, HFILL}},
 
+        { &hf_swils_zone_mbrid_fcwwn,
+          {"Member Identifier", "swils.zone.mbrid.fcwwn",
+           FT_FCWWN, BASE_NONE, NULL, 0x0,
+           NULL, HFILL}},
+
+        { &hf_swils_zone_mbrid_fc,
+          {"Member Identifier", "swils.zone.mbrid.fc",
+           FT_BYTES, SEP_DOT, NULL, 0x0,
+           NULL, HFILL}},
+
+        { &hf_swils_zone_mbrid_uint,
+          {"Member Identifier", "swils.zone.mbrid.uint",
+           FT_UINT32, BASE_HEX, NULL, 0x0,
+           NULL, HFILL}},
+
         { &hf_swils_zone_status,
           {"Zone Command Status", "swils.zone.status",
            FT_UINT8, BASE_HEX, VALS(fc_swils_mr_rsp_val), 0x0,
@@ -2521,6 +2521,7 @@ proto_register_fcswils(void)
     static ei_register_info ei[] = {
         { &ei_swils_efp_record_len, { "swils.efp.recordlen.zero", PI_UNDECODED, PI_NOTE, "Record length is zero", EXPFILL }},
         { &ei_swils_no_exchange, { "swils.no_exchange", PI_UNDECODED, PI_WARN, "No record of Exchg. Unable to decode", EXPFILL }},
+        { &ei_swils_zone_mbrid, { "swils.zone.mbrid.unknown_type", PI_PROTOCOL, PI_WARN, "Unknown member type format", EXPFILL }},
     };
 
     expert_module_t* expert_fcswils;
@@ -2532,6 +2533,7 @@ proto_register_fcswils(void)
     expert_fcswils = expert_register_protocol(proto_fcswils);
     expert_register_field_array(expert_fcswils, ei, array_length(ei));
     register_init_routine(&fcswils_init_protocol);
+    register_cleanup_routine(&fcswils_cleanup_protocol);
 }
 
 void