Use consistent indentation; Whitesapce & formatting cleanup.
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 11 May 2010 16:54:55 +0000 (16:54 +0000)
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 11 May 2010 16:54:55 +0000 (16:54 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@32755 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-bgp.c
epan/dissectors/packet-bittorrent.c
epan/dissectors/packet-dcerpc-netlogon.c
epan/dissectors/packet-dcerpc.c
epan/dissectors/packet-gsm_a_bssmap.c

index 23d7f09fa325a5c601ddb42677046b2bf6d293db..252e92902b8cc481ffed5e8591592c32cbd7b0b4 100644 (file)
@@ -392,7 +392,7 @@ static gint ett_bgp_ext_com_flags = -1; /* extended communities flags tree */
 static gint ett_bgp_ssa = -1;          /* safi specific attribute */
 static gint ett_bgp_ssa_subtree = -1;  /* safi specific attribute Subtrees */
 static gint ett_bgp_orf = -1;          /* orf (outbound route filter) tree */
-static gint ett_bgp_orf_entry = -1;            /* orf entry tree */
+static gint ett_bgp_orf_entry = -1;    /* orf entry tree */
 
 /* desegmentation */
 static gboolean bgp_desegment = TRUE;
@@ -427,7 +427,7 @@ decode_prefix4(proto_tree *tree, int hf_addr, tvbuff_t *tvb, gint offset,
     /* put prefix into protocol tree */
     ti = proto_tree_add_text(tree, tvb, offset,
             tlen != 0 ? tlen : 1 + length, "%s/%u",
-       ip_to_str(ip_addr.addr_bytes), plen);
+                             ip_to_str(ip_addr.addr_bytes), plen);
     prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
     proto_tree_add_text(prefix_tree, tvb, offset, 1, "%s prefix length: %u",
        tag, plen);
@@ -538,118 +538,118 @@ mp_addr_to_str (guint16 afi, guint8 safi, tvbuff_t *tvb, gint offset, emem_strbu
     length = 0 ;
     switch (afi) {
         case AFNUM_INET:
-                switch (safi) {
-                        case SAFNUM_UNICAST:
-                        case SAFNUM_MULCAST:
-                        case SAFNUM_UNIMULC:
-                        case SAFNUM_MPLS_LABEL:
-                       case SAFNUM_TUNNEL:
-                                length = 4 ;
-                                ip4addr = tvb_get_ipv4(tvb, offset);
-                               ep_strbuf_append(strbuf, ip_to_str((guint8 *)&ip4addr));
-                                break;
-                        case SAFNUM_LAB_VPNUNICAST:
-                        case SAFNUM_LAB_VPNMULCAST:
-                        case SAFNUM_LAB_VPNUNIMULC:
-                                rd_type=tvb_get_ntohs(tvb,offset) ;
-                                switch (rd_type) {
-                                        case FORMAT_AS2_LOC:
-                                                length = 8 + sizeof(ip4addr);
-                                                ip4addr = tvb_get_ipv4(tvb, offset + 8);   /* Next Hop */
-                                                ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv4=%s",
-                                                                tvb_get_ntohs(tvb, offset + 2),
-                                                                tvb_get_ntohl(tvb, offset + 4),
-                                                                ip_to_str((guint8 *)&ip4addr));
-                                                break;
-                                        case FORMAT_IP_LOC:
-                                                length = 8 + sizeof(ip4addr);
-                                                ip4addr = tvb_get_ipv4(tvb, offset + 2);   /* IP part of the RD            */
-                                                ip4addr2 = tvb_get_ipv4(tvb, offset + 8);  /* Next Hop   */
-                                                ep_strbuf_printf(strbuf, "Empty Label Stack RD=%s:%u IPv4=%s",
-                                                                ip_to_str((guint8 *)&ip4addr),
-                                                                tvb_get_ntohs(tvb, offset + 6),
-                                                                ip_to_str((guint8 *)&ip4addr2));
-                                                break ;
-                                        default:
-                                                length = 0 ;
-                                                ep_strbuf_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv4 address format",rd_type);
-                                                break;
-                                }
-                                break;
+            switch (safi) {
+                case SAFNUM_UNICAST:
+                case SAFNUM_MULCAST:
+                case SAFNUM_UNIMULC:
+                case SAFNUM_MPLS_LABEL:
+                case SAFNUM_TUNNEL:
+                    length = 4 ;
+                    ip4addr = tvb_get_ipv4(tvb, offset);
+                    ep_strbuf_append(strbuf, ip_to_str((guint8 *)&ip4addr));
+                    break;
+                case SAFNUM_LAB_VPNUNICAST:
+                case SAFNUM_LAB_VPNMULCAST:
+                case SAFNUM_LAB_VPNUNIMULC:
+                    rd_type=tvb_get_ntohs(tvb,offset) ;
+                    switch (rd_type) {
+                        case FORMAT_AS2_LOC:
+                            length = 8 + sizeof(ip4addr);
+                            ip4addr = tvb_get_ipv4(tvb, offset + 8);   /* Next Hop */
+                            ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv4=%s",
+                                             tvb_get_ntohs(tvb, offset + 2),
+                                             tvb_get_ntohl(tvb, offset + 4),
+                                             ip_to_str((guint8 *)&ip4addr));
+                            break;
+                        case FORMAT_IP_LOC:
+                            length = 8 + sizeof(ip4addr);
+                            ip4addr = tvb_get_ipv4(tvb, offset + 2);   /* IP part of the RD            */
+                            ip4addr2 = tvb_get_ipv4(tvb, offset + 8);  /* Next Hop   */
+                            ep_strbuf_printf(strbuf, "Empty Label Stack RD=%s:%u IPv4=%s",
+                                             ip_to_str((guint8 *)&ip4addr),
+                                             tvb_get_ntohs(tvb, offset + 6),
+                                             ip_to_str((guint8 *)&ip4addr2));
+                            break ;
                         default:
                             length = 0 ;
-                            ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
+                            ep_strbuf_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv4 address format",rd_type);
                             break;
-                }
-                break;
+                    } /* switch (rd_type) */
+                    break;
+                default:
+                    length = 0 ;
+                    ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
+                    break;
+            } /* switch (safi) */
+            break;
         case AFNUM_INET6:
-                switch (safi) {
-                        case SAFNUM_UNICAST:
-                        case SAFNUM_MULCAST:
-                        case SAFNUM_UNIMULC:
-                        case SAFNUM_MPLS_LABEL:
-                       case SAFNUM_TUNNEL:
-                            length = 16 ;
-                            tvb_get_ipv6(tvb, offset, &ip6addr);
-                            ep_strbuf_printf(strbuf, "%s", ip6_to_str(&ip6addr));
+            switch (safi) {
+                case SAFNUM_UNICAST:
+                case SAFNUM_MULCAST:
+                case SAFNUM_UNIMULC:
+                case SAFNUM_MPLS_LABEL:
+                case SAFNUM_TUNNEL:
+                    length = 16 ;
+                    tvb_get_ipv6(tvb, offset, &ip6addr);
+                    ep_strbuf_printf(strbuf, "%s", ip6_to_str(&ip6addr));
+                    break;
+                case SAFNUM_LAB_VPNUNICAST:
+                case SAFNUM_LAB_VPNMULCAST:
+                case SAFNUM_LAB_VPNUNIMULC:
+                    rd_type=tvb_get_ntohs(tvb,offset) ;
+                    switch (rd_type) {
+                        case FORMAT_AS2_LOC:
+                            length = 8 + 16;
+                            tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
+                            ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s",
+                                             tvb_get_ntohs(tvb, offset + 2),
+                                             tvb_get_ntohl(tvb, offset + 4),
+                                             ip6_to_str(&ip6addr));
                             break;
-                        case SAFNUM_LAB_VPNUNICAST:
-                        case SAFNUM_LAB_VPNMULCAST:
-                        case SAFNUM_LAB_VPNUNIMULC:
-                                rd_type=tvb_get_ntohs(tvb,offset) ;
-                                switch (rd_type) {
-                                        case FORMAT_AS2_LOC:
-                                                length = 8 + 16;
-                                                tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
-                                                ep_strbuf_printf(strbuf, "Empty Label Stack RD=%u:%u IPv6=%s",
-                                                                tvb_get_ntohs(tvb, offset + 2),
-                                                                tvb_get_ntohl(tvb, offset + 4),
-                                                                ip6_to_str(&ip6addr));
-                                                break;
-                                        case FORMAT_IP_LOC:
-                                                length = 8 + 16;
-                                                ip4addr = tvb_get_ipv4(tvb, offset + 2);   /* IP part of the RD            */
-                                                tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
-                                                ep_strbuf_printf(strbuf, "Empty Label Stack RD=%s:%u IPv6=%s",
-                                                                ip_to_str((guint8 *)&ip4addr),
-                                                                tvb_get_ntohs(tvb, offset + 6),
-                                                                ip6_to_str(&ip6addr));
-                                                break ;
-                                        default:
-                                                length = 0 ;
-                                                ep_strbuf_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv6 address format",rd_type);
-                                                break;
-                                }
-                                break;
+                        case FORMAT_IP_LOC:
+                            length = 8 + 16;
+                            ip4addr = tvb_get_ipv4(tvb, offset + 2);   /* IP part of the RD            */
+                            tvb_get_ipv6(tvb, offset + 8, &ip6addr); /* Next Hop */
+                            ep_strbuf_printf(strbuf, "Empty Label Stack RD=%s:%u IPv6=%s",
+                                             ip_to_str((guint8 *)&ip4addr),
+                                             tvb_get_ntohs(tvb, offset + 6),
+                                             ip6_to_str(&ip6addr));
+                            break ;
                         default:
                             length = 0 ;
-                            ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
+                            ep_strbuf_printf(strbuf, "Unknown (0x%04x) labeled VPN IPv6 address format",rd_type);
                             break;
-                }
-                break;
+                    }  /* switch (rd_type) */
+                    break;
+                default:
+                    length = 0 ;
+                    ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
+                    break;
+            } /* switch (safi) */
+            break;
        case AFNUM_L2VPN:
-       case AFNUM_L2VPN_OLD:
-                switch (safi) {
-                        case SAFNUM_LAB_VPNUNICAST: /* only labeles prefixes do make sense */
-                        case SAFNUM_LAB_VPNMULCAST:
-                        case SAFNUM_LAB_VPNUNIMULC:
-                        case SAFNUM_VPLS:
-                            length = 4; /* the next-hop is simply an ipv4 addr */
-                            ip4addr = tvb_get_ipv4(tvb, offset + 0);
-                            ep_strbuf_printf(strbuf, "IPv4=%s",
+        case AFNUM_L2VPN_OLD:
+            switch (safi) {
+                case SAFNUM_LAB_VPNUNICAST: /* only labeles prefixes do make sense */
+                case SAFNUM_LAB_VPNMULCAST:
+                case SAFNUM_LAB_VPNUNIMULC:
+                case SAFNUM_VPLS:
+                    length = 4; /* the next-hop is simply an ipv4 addr */
+                    ip4addr = tvb_get_ipv4(tvb, offset + 0);
+                    ep_strbuf_printf(strbuf, "IPv4=%s",
                                      ip_to_str((guint8 *)&ip4addr));
-                            break;
-                        default:
-                            length = 0 ;
-                            ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
-                            break;
-                }
-                break;
+                    break;
+                default:
+                    length = 0 ;
+                    ep_strbuf_printf(strbuf, "Unknown SAFI (%u) for AFI %u", safi, afi);
+                    break;
+            } /* switch (safi) */
+            break;
         default:
-                length = 0 ;
-                ep_strbuf_printf(strbuf, "Unknown AFI (%u) value", afi);
-                break;
-    }
+            length = 0 ;
+            ep_strbuf_printf(strbuf, "Unknown AFI (%u) value", afi);
+            break;
+    } /* switch (afi) */
     return(length) ;
 }
 
@@ -682,422 +682,422 @@ decode_prefix_MP(proto_tree *tree, int hf_addr4, int hf_addr6,
     case AFNUM_INET:
         switch (safi) {
 
-        case SAFNUM_UNICAST:
-        case SAFNUM_MULCAST:
-        case SAFNUM_UNIMULC:
-            total_length = decode_prefix4(tree, hf_addr4, tvb, offset, 0, tag);
-            if (total_length < 0)
-                return -1;
-            break;
-
-        case SAFNUM_MPLS_LABEL:
-            plen =  tvb_get_guint8(tvb, offset);
-            stack_strbuf = ep_strbuf_new_label(NULL);
-            labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
-
-            offset += (1 + labnum * 3);
-            if (plen <= (labnum * 3*8)) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled IPv4 prefix length %u invalid",
-                        tag, plen);
-                return -1;
-            }
-            plen -= (labnum * 3*8);
-            length = ipv4_addr_and_mask(tvb, offset, ip4addr.addr_bytes, plen);
-            if (length < 0) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled IPv4 prefix length %u invalid",
-                        tag, plen + (labnum * 3*8));
-                return -1;
-            }
-
-            ti = proto_tree_add_text(tree, tvb, start_offset,
-                    (offset + length) - start_offset,
-                    "Label Stack=%s IPv4=%s/%u",
-                    stack_strbuf->str, ip_to_str(ip4addr.addr_bytes), plen);
-            prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
-            proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
-                tag, plen + labnum * 3 * 8);
-            proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum, "%s Label Stack: %s",
-                tag, stack_strbuf->str);
-            if (hf_addr4 != -1) {
-                proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset,
-                        length, ip4addr.addr);
-            } else {
-                proto_tree_add_text(prefix_tree, tvb, offset, length,
-                        "%s IPv4 prefix: %s",
-                        tag, ip_to_str(ip4addr.addr_bytes));
-            }
-            total_length = (1 + labnum*3) + length;
-            break;
-
-       case SAFNUM_TUNNEL:
-           plen =  tvb_get_guint8(tvb, offset);
-           if (plen <= 16){
-               proto_tree_add_text(tree, tvb, start_offset, 1,
-                       "%s Tunnel IPv4 prefix length %u invalid",
-                       tag, plen);
-               return -1;
-           }
-           tnl_id = tvb_get_ntohs(tvb, offset + 1);
-           offset += 3; /* Length + Tunnel Id */
-           plen -= 16; /* 2-octet Identifier */
-           length = ipv4_addr_and_mask(tvb, offset, ip4addr.addr_bytes, plen);
-           if (length < 0) {
-               proto_tree_add_text(tree, tvb, start_offset, 1,
-                       "%s Tunnel IPv4 prefix length %u invalid",
-                       tag, plen + 16);
-               return -1;
-           }
-           ti = proto_tree_add_text(tree, tvb, start_offset,
-                       (offset + length) - start_offset,
-                       "Tunnel Identifier=0x%x IPv4=%s/%u",
-                       tnl_id, ip_to_str(ip4addr.addr_bytes), plen);
-           prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
-
-           proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
-               tag, plen + 16);
-           proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
-                               start_offset + 1, 2, FALSE);
-           if (hf_addr4 != -1) {
-               proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset,
-                               length, ip4addr.addr);
-           } else {
-               proto_tree_add_text(prefix_tree, tvb, offset, length,
-                       "%s IPv4 prefix: %s",
-                       tag, ip_to_str(ip4addr.addr_bytes));
-           }
-           total_length = 1 + 2 + length; /* length field + Tunnel Id + IPv4 len */
-           break;
-
-        case SAFNUM_LAB_VPNUNICAST:
-        case SAFNUM_LAB_VPNMULCAST:
-        case SAFNUM_LAB_VPNUNIMULC:
-            plen =  tvb_get_guint8(tvb, offset);
-            stack_strbuf = ep_strbuf_new_label(NULL);
-            labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
-
-            offset += (1 + labnum * 3);
-            if (plen <= (labnum * 3*8)) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled VPN IPv4 prefix length %u invalid",
-                        tag, plen);
-                return -1;
-            }
-            plen -= (labnum * 3*8);
-
-            rd_type = tvb_get_ntohs(tvb, offset);
-            if (plen < 8*8) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled VPN IPv4 prefix length %u invalid",
-                        tag, plen + (labnum * 3*8));
-                return -1;
-            }
-            plen -= 8*8;
+            case SAFNUM_UNICAST:
+            case SAFNUM_MULCAST:
+            case SAFNUM_UNIMULC:
+                total_length = decode_prefix4(tree, hf_addr4, tvb, offset, 0, tag);
+                if (total_length < 0)
+                    return -1;
+                break;
 
-            switch (rd_type) {
+            case SAFNUM_MPLS_LABEL:
+                plen =  tvb_get_guint8(tvb, offset);
+                stack_strbuf = ep_strbuf_new_label(NULL);
+                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
 
-            case FORMAT_AS2_LOC: /* Code borrowed from the decode_prefix4 function */
-                length = ipv4_addr_and_mask(tvb, offset + 8, ip4addr.addr_bytes, plen);
+                offset += (1 + labnum * 3);
+                if (plen <= (labnum * 3*8)) {
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Labeled IPv4 prefix length %u invalid",
+                                        tag, plen);
+                    return -1;
+                }
+                plen -= (labnum * 3*8);
+                length = ipv4_addr_and_mask(tvb, offset, ip4addr.addr_bytes, plen);
                 if (length < 0) {
                     proto_tree_add_text(tree, tvb, start_offset, 1,
-                            "%s Labeled VPN IPv4 prefix length %u invalid",
-                            tag, plen + (labnum * 3*8) + 8*8);
+                                        "%s Labeled IPv4 prefix length %u invalid",
+                                        tag, plen + (labnum * 3*8));
                     return -1;
                 }
 
                 ti = proto_tree_add_text(tree, tvb, start_offset,
-                        (offset + 8 + length) - start_offset,
-                        "Label Stack=%s RD=%u:%u, IPv4=%s/%u",
-                        stack_strbuf->str,
-                        tvb_get_ntohs(tvb, offset + 2),
-                        tvb_get_ntohl(tvb, offset + 4),
-                        ip_to_str(ip4addr.addr_bytes), plen);
+                                         (offset + length) - start_offset,
+                                         "Label Stack=%s IPv4=%s/%u",
+                                         stack_strbuf->str, ip_to_str(ip4addr.addr_bytes), plen);
                 prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
                 proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
-                        tag, plen + labnum * 3 * 8 + 8 * 8);
-                proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
-                        "%s Label Stack: %s", tag, stack_strbuf->str);
-                proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
-                        "%s Route Distinguisher: %u:%u", tag, tvb_get_ntohs(tvb, offset + 2),
-                        tvb_get_ntohl(tvb, offset + 4));
+                                    tag, plen + labnum * 3 * 8);
+                proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum, "%s Label Stack: %s",
+                                    tag, stack_strbuf->str);
                 if (hf_addr4 != -1) {
-                    proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb,
-                            offset + 8, length, ip4addr.addr);
+                    proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset,
+                                        length, ip4addr.addr);
                 } else {
-                    proto_tree_add_text(prefix_tree, tvb, offset + 8,
-                            length, "%s IPv4 prefix: %s", tag,
-                            ip_to_str(ip4addr.addr_bytes));
+                    proto_tree_add_text(prefix_tree, tvb, offset, length,
+                                        "%s IPv4 prefix: %s",
+                                        tag, ip_to_str(ip4addr.addr_bytes));
                 }
-                total_length = (1 + labnum * 3 + 8) + length;
+                total_length = (1 + labnum*3) + length;
                 break;
 
-            case FORMAT_IP_LOC: /* Code borrowed from the decode_prefix4 function */
-                tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 2, 4);
-
-                length = ipv4_addr_and_mask(tvb, offset + 8, ip4addr2.addr_bytes, plen);
+            case SAFNUM_TUNNEL:
+                plen =  tvb_get_guint8(tvb, offset);
+                if (plen <= 16){
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Tunnel IPv4 prefix length %u invalid",
+                                        tag, plen);
+                    return -1;
+                }
+                tnl_id = tvb_get_ntohs(tvb, offset + 1);
+                offset += 3; /* Length + Tunnel Id */
+                plen -= 16; /* 2-octet Identifier */
+                length = ipv4_addr_and_mask(tvb, offset, ip4addr.addr_bytes, plen);
                 if (length < 0) {
-                        proto_tree_add_text(tree, tvb, start_offset, 1,
-                                "%s Labeled VPN IPv4 prefix length %u invalid",
-                                tag, plen + (labnum * 3*8) + 8*8);
-                        return -1;
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Tunnel IPv4 prefix length %u invalid",
+                                        tag, plen + 16);
+                    return -1;
                 }
-
                 ti = proto_tree_add_text(tree, tvb, start_offset,
-                        (offset + 8 + length) - start_offset,
-                        "Label Stack=%s RD=%s:%u, IPv4=%s/%u",
-                        stack_strbuf->str,
-                        ip_to_str(ip4addr.addr_bytes),
-                        tvb_get_ntohs(tvb, offset + 6),
-                        ip_to_str(ip4addr2.addr_bytes),
-                        plen);
-               prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
-               proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
-                       tag, plen + labnum * 3 * 8 + 8 * 8);
-               proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
-                       "%s Label Stack: %s", tag, stack_strbuf->str);
-               proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
-                       "%s Route Distinguisher: %s:%u", tag, ip_to_str(ip4addr.addr_bytes),
-                       tvb_get_ntohs(tvb, offset + 6));
-               if (hf_addr4 != -1) {
-                       proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb,
-                               offset + 8, length, ip4addr2.addr);
-               } else {
-                       proto_tree_add_text(prefix_tree, tvb, offset + 8,
-                               length, "%s IPv4 prefix: %s", tag,
-                               ip_to_str(ip4addr2.addr_bytes));
-               }
-                total_length = (1 + labnum * 3 + 8) + length;
+                                         (offset + length) - start_offset,
+                                         "Tunnel Identifier=0x%x IPv4=%s/%u",
+                                         tnl_id, ip_to_str(ip4addr.addr_bytes), plen);
+                prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
+
+                proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
+                                    tag, plen + 16);
+                proto_tree_add_item(prefix_tree, hf_bgp_mp_nlri_tnl_id, tvb,
+                                    start_offset + 1, 2, FALSE);
+                if (hf_addr4 != -1) {
+                    proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb, offset,
+                                        length, ip4addr.addr);
+                } else {
+                    proto_tree_add_text(prefix_tree, tvb, offset, length,
+                                        "%s IPv4 prefix: %s",
+                                        tag, ip_to_str(ip4addr.addr_bytes));
+                }
+                total_length = 1 + 2 + length; /* length field + Tunnel Id + IPv4 len */
                 break;
 
-            default:
-                proto_tree_add_text(tree, tvb, start_offset,
-                        (offset - start_offset) + 2,
-                        "Unknown labeled VPN IPv4 address format %u", rd_type);
-                return -1;
-            }
-            break;
+            case SAFNUM_LAB_VPNUNICAST:
+            case SAFNUM_LAB_VPNMULCAST:
+            case SAFNUM_LAB_VPNUNIMULC:
+                plen =  tvb_get_guint8(tvb, offset);
+                stack_strbuf = ep_strbuf_new_label(NULL);
+                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
 
-        default:
-            proto_tree_add_text(tree, tvb, start_offset, 0,
-                    "Unknown SAFI (%u) for AFI %u", safi, afi);
-            return -1;
-        }
-        break;
+                offset += (1 + labnum * 3);
+                if (plen <= (labnum * 3*8)) {
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Labeled VPN IPv4 prefix length %u invalid",
+                                        tag, plen);
+                    return -1;
+                }
+                plen -= (labnum * 3*8);
 
-    case AFNUM_INET6:
-        switch (safi) {
+                rd_type = tvb_get_ntohs(tvb, offset);
+                if (plen < 8*8) {
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Labeled VPN IPv4 prefix length %u invalid",
+                                        tag, plen + (labnum * 3*8));
+                    return -1;
+                }
+                plen -= 8*8;
 
-        case SAFNUM_UNICAST:
-        case SAFNUM_MULCAST:
-        case SAFNUM_UNIMULC:
-            total_length = decode_prefix6(tree, hf_addr6, tvb, offset, 0, tag);
-            if (total_length < 0)
-                return -1;
-            break;
+                switch (rd_type) {
 
-        case SAFNUM_MPLS_LABEL:
-            plen =  tvb_get_guint8(tvb, offset);
-            stack_strbuf = ep_strbuf_new_label(NULL);
-            labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
+                    case FORMAT_AS2_LOC: /* Code borrowed from the decode_prefix4 function */
+                        length = ipv4_addr_and_mask(tvb, offset + 8, ip4addr.addr_bytes, plen);
+                        if (length < 0) {
+                            proto_tree_add_text(tree, tvb, start_offset, 1,
+                                                "%s Labeled VPN IPv4 prefix length %u invalid",
+                                                tag, plen + (labnum * 3*8) + 8*8);
+                            return -1;
+                        }
 
-            offset += (1 + labnum * 3);
-            if (plen <= (labnum * 3*8)) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled IPv6 prefix length %u invalid", tag, plen);
-                return -1;
-            }
-            plen -= (labnum * 3*8);
+                        ti = proto_tree_add_text(tree, tvb, start_offset,
+                                                 (offset + 8 + length) - start_offset,
+                                                 "Label Stack=%s RD=%u:%u, IPv4=%s/%u",
+                                                 stack_strbuf->str,
+                                                 tvb_get_ntohs(tvb, offset + 2),
+                                                 tvb_get_ntohl(tvb, offset + 4),
+                                                 ip_to_str(ip4addr.addr_bytes), plen);
+                        prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
+                        proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
+                                            tag, plen + labnum * 3 * 8 + 8 * 8);
+                        proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
+                                            "%s Label Stack: %s", tag, stack_strbuf->str);
+                        proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
+                                            "%s Route Distinguisher: %u:%u", tag, tvb_get_ntohs(tvb, offset + 2),
+                                            tvb_get_ntohl(tvb, offset + 4));
+                        if (hf_addr4 != -1) {
+                            proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb,
+                                                offset + 8, length, ip4addr.addr);
+                        } else {
+                            proto_tree_add_text(prefix_tree, tvb, offset + 8,
+                                                length, "%s IPv4 prefix: %s", tag,
+                                                ip_to_str(ip4addr.addr_bytes));
+                        }
+                        total_length = (1 + labnum * 3 + 8) + length;
+                        break;
 
-            length = ipv6_addr_and_mask(tvb, offset, &ip6addr, plen);
-            if (length < 0) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled IPv6 prefix length %u invalid",
-                       tag, plen  + (labnum * 3*8));
-                return -1;
-            }
+                    case FORMAT_IP_LOC: /* Code borrowed from the decode_prefix4 function */
+                        tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 2, 4);
 
-           ti = proto_tree_add_text(tree, tvb, start_offset,
-                (offset + length) - start_offset,
-                 "Label Stack=%s, IPv6=%s/%u",
-                 stack_strbuf->str,
-                 ip6_to_str(&ip6addr), plen);
-           total_length = (1 + labnum * 3) + length;
-           break;
+                        length = ipv4_addr_and_mask(tvb, offset + 8, ip4addr2.addr_bytes, plen);
+                        if (length < 0) {
+                            proto_tree_add_text(tree, tvb, start_offset, 1,
+                                                "%s Labeled VPN IPv4 prefix length %u invalid",
+                                                tag, plen + (labnum * 3*8) + 8*8);
+                            return -1;
+                        }
 
-       case SAFNUM_TUNNEL:
-            plen =  tvb_get_guint8(tvb, offset);
-            if (plen <= 16){
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Tunnel IPv6 prefix length %u invalid",
-                        tag, plen);
-                return -1;
-            }
-            tnl_id = tvb_get_ntohs(tvb, offset + 1);
-            offset += 3; /* Length + Tunnel Id */
-            plen -= 16; /* 2-octet Identifier */
-            length = ipv6_addr_and_mask(tvb, offset, &ip6addr, plen);
-            if (length < 0) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Tunnel IPv6 prefix length %u invalid",
-                        tag, plen + 16);
-                return -1;
-            }
-            ti = proto_tree_add_text(tree, tvb, start_offset,
-                        (offset + length) - start_offset,
-                        "Tunnel Identifier=0x%x IPv6=%s/%u",
-                        tnl_id, ip6_to_str(&ip6addr), plen);
-            total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */
-            break;
+                        ti = proto_tree_add_text(tree, tvb, start_offset,
+                                                 (offset + 8 + length) - start_offset,
+                                                 "Label Stack=%s RD=%s:%u, IPv4=%s/%u",
+                                                 stack_strbuf->str,
+                                                 ip_to_str(ip4addr.addr_bytes),
+                                                 tvb_get_ntohs(tvb, offset + 6),
+                                                 ip_to_str(ip4addr2.addr_bytes),
+                                                 plen);
+                        prefix_tree = proto_item_add_subtree(ti, ett_bgp_prefix);
+                        proto_tree_add_text(prefix_tree, tvb, start_offset, 1, "%s Prefix length: %u",
+                                            tag, plen + labnum * 3 * 8 + 8 * 8);
+                        proto_tree_add_text(prefix_tree, tvb, start_offset + 1, 3 * labnum,
+                                            "%s Label Stack: %s", tag, stack_strbuf->str);
+                        proto_tree_add_text(prefix_tree, tvb, start_offset + 1 + 3 * labnum, 8,
+                                            "%s Route Distinguisher: %s:%u", tag, ip_to_str(ip4addr.addr_bytes),
+                                            tvb_get_ntohs(tvb, offset + 6));
+                        if (hf_addr4 != -1) {
+                            proto_tree_add_ipv4(prefix_tree, hf_addr4, tvb,
+                                                offset + 8, length, ip4addr2.addr);
+                        } else {
+                            proto_tree_add_text(prefix_tree, tvb, offset + 8,
+                                                length, "%s IPv4 prefix: %s", tag,
+                                                ip_to_str(ip4addr2.addr_bytes));
+                        }
+                        total_length = (1 + labnum * 3 + 8) + length;
+                        break;
 
-        case SAFNUM_LAB_VPNUNICAST:
-        case SAFNUM_LAB_VPNMULCAST:
-        case SAFNUM_LAB_VPNUNIMULC:
-            plen =  tvb_get_guint8(tvb, offset);
-            stack_strbuf = ep_strbuf_new_label(NULL);
-            labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
-
-            offset += (1 + labnum * 3);
-            if (plen <= (labnum * 3*8)) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
-                return -1;
-            }
-            plen -= (labnum * 3*8);
+                    default:
+                        proto_tree_add_text(tree, tvb, start_offset,
+                                            (offset - start_offset) + 2,
+                                            "Unknown labeled VPN IPv4 address format %u", rd_type);
+                        return -1;
+                } /* switch (rd_type) */
+                break;
 
-            rd_type = tvb_get_ntohs(tvb,offset);
-            if (plen < 8*8) {
-                proto_tree_add_text(tree, tvb, start_offset, 1,
-                        "%s Labeled VPN IPv6 prefix length %u invalid",
-                        tag, plen + (labnum * 3*8));
+            default:
+                proto_tree_add_text(tree, tvb, start_offset, 0,
+                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
                 return -1;
-            }
-            plen -= 8*8;
+        } /* switch (safi) */
+        break;
+
+    case AFNUM_INET6:
+        switch (safi) {
+
+            case SAFNUM_UNICAST:
+            case SAFNUM_MULCAST:
+            case SAFNUM_UNIMULC:
+                total_length = decode_prefix6(tree, hf_addr6, tvb, offset, 0, tag);
+                if (total_length < 0)
+                    return -1;
+                break;
 
-            switch (rd_type) {
+            case SAFNUM_MPLS_LABEL:
+                plen =  tvb_get_guint8(tvb, offset);
+                stack_strbuf = ep_strbuf_new_label(NULL);
+                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
 
-            case FORMAT_AS2_LOC:
-                length = ipv6_addr_and_mask(tvb, offset + 8, &ip6addr, plen);
+                offset += (1 + labnum * 3);
+                if (plen <= (labnum * 3*8)) {
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Labeled IPv6 prefix length %u invalid", tag, plen);
+                    return -1;
+                }
+                plen -= (labnum * 3*8);
+
+                length = ipv6_addr_and_mask(tvb, offset, &ip6addr, plen);
                 if (length < 0) {
                     proto_tree_add_text(tree, tvb, start_offset, 1,
-                            "%s Labeled VPN IPv6 prefix length %u invalid",
-                            tag, plen + (labnum * 3*8) + 8*8);
+                                        "%s Labeled IPv6 prefix length %u invalid",
+                                        tag, plen  + (labnum * 3*8));
                     return -1;
                 }
 
                 ti = proto_tree_add_text(tree, tvb, start_offset,
-                        (offset + 8 + length) - start_offset,
-                        "Label Stack=%s RD=%u:%u, IPv6=%s/%u",
-                        stack_strbuf->str,
-                        tvb_get_ntohs(tvb, offset + 2),
-                        tvb_get_ntohl(tvb, offset + 4),
-                        ip6_to_str(&ip6addr), plen);
-                total_length = (1 + labnum * 3 + 8) + length;
+                                         (offset + length) - start_offset,
+                                         "Label Stack=%s, IPv6=%s/%u",
+                                         stack_strbuf->str,
+                                         ip6_to_str(&ip6addr), plen);
+                total_length = (1 + labnum * 3) + length;
                 break;
 
-            case FORMAT_IP_LOC:
-                tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 2, 4);
-
-                length = ipv6_addr_and_mask(tvb, offset + 8, &ip6addr, plen);
+            case SAFNUM_TUNNEL:
+                plen =  tvb_get_guint8(tvb, offset);
+                if (plen <= 16){
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Tunnel IPv6 prefix length %u invalid",
+                                        tag, plen);
+                    return -1;
+                }
+                tnl_id = tvb_get_ntohs(tvb, offset + 1);
+                offset += 3; /* Length + Tunnel Id */
+                plen -= 16; /* 2-octet Identifier */
+                length = ipv6_addr_and_mask(tvb, offset, &ip6addr, plen);
                 if (length < 0) {
                     proto_tree_add_text(tree, tvb, start_offset, 1,
-                            "%s Labeled VPN IPv6 prefix length %u invalid",
-                            tag, plen + (labnum * 3*8) + 8*8);
+                                        "%s Tunnel IPv6 prefix length %u invalid",
+                                        tag, plen + 16);
                     return -1;
                 }
-
                 ti = proto_tree_add_text(tree, tvb, start_offset,
-                        (offset + 8 + length) - start_offset,
-                        "Label Stack=%s RD=%s:%u, IPv6=%s/%u",
-                        stack_strbuf->str,
-                        ip_to_str(ip4addr.addr_bytes),
-                        tvb_get_ntohs(tvb, offset + 6),
-                        ip6_to_str(&ip6addr), plen);
-                total_length = (1 + labnum * 3 + 8) + length;
+                                         (offset + length) - start_offset,
+                                         "Tunnel Identifier=0x%x IPv6=%s/%u",
+                                         tnl_id, ip6_to_str(&ip6addr), plen);
+                total_length = (1 + 2) + length; /* length field + Tunnel Id + IPv4 len */
+                break;
+
+            case SAFNUM_LAB_VPNUNICAST:
+            case SAFNUM_LAB_VPNMULCAST:
+            case SAFNUM_LAB_VPNUNIMULC:
+                plen =  tvb_get_guint8(tvb, offset);
+                stack_strbuf = ep_strbuf_new_label(NULL);
+                labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf);
+
+                offset += (1 + labnum * 3);
+                if (plen <= (labnum * 3*8)) {
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
+                    return -1;
+                }
+                plen -= (labnum * 3*8);
+
+                rd_type = tvb_get_ntohs(tvb,offset);
+                if (plen < 8*8) {
+                    proto_tree_add_text(tree, tvb, start_offset, 1,
+                                        "%s Labeled VPN IPv6 prefix length %u invalid",
+                                        tag, plen + (labnum * 3*8));
+                    return -1;
+                }
+                plen -= 8*8;
+
+                switch (rd_type) {
+
+                    case FORMAT_AS2_LOC:
+                        length = ipv6_addr_and_mask(tvb, offset + 8, &ip6addr, plen);
+                        if (length < 0) {
+                            proto_tree_add_text(tree, tvb, start_offset, 1,
+                                                "%s Labeled VPN IPv6 prefix length %u invalid",
+                                                tag, plen + (labnum * 3*8) + 8*8);
+                            return -1;
+                        }
+
+                        ti = proto_tree_add_text(tree, tvb, start_offset,
+                                                 (offset + 8 + length) - start_offset,
+                                                 "Label Stack=%s RD=%u:%u, IPv6=%s/%u",
+                                                 stack_strbuf->str,
+                                                 tvb_get_ntohs(tvb, offset + 2),
+                                                 tvb_get_ntohl(tvb, offset + 4),
+                                                 ip6_to_str(&ip6addr), plen);
+                        total_length = (1 + labnum * 3 + 8) + length;
+                        break;
+
+                    case FORMAT_IP_LOC:
+                        tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 2, 4);
+
+                        length = ipv6_addr_and_mask(tvb, offset + 8, &ip6addr, plen);
+                        if (length < 0) {
+                            proto_tree_add_text(tree, tvb, start_offset, 1,
+                                                "%s Labeled VPN IPv6 prefix length %u invalid",
+                                                tag, plen + (labnum * 3*8) + 8*8);
+                            return -1;
+                        }
+
+                        ti = proto_tree_add_text(tree, tvb, start_offset,
+                                                 (offset + 8 + length) - start_offset,
+                                                 "Label Stack=%s RD=%s:%u, IPv6=%s/%u",
+                                                 stack_strbuf->str,
+                                                 ip_to_str(ip4addr.addr_bytes),
+                                                 tvb_get_ntohs(tvb, offset + 6),
+                                                 ip6_to_str(&ip6addr), plen);
+                        total_length = (1 + labnum * 3 + 8) + length;
+                        break;
+
+                    default:
+                        proto_tree_add_text(tree, tvb, start_offset, 0,
+                                            "Unknown labeled VPN IPv6 address format %u", rd_type);
+                        return -1;
+                } /* switch (rd_type) */
                 break;
 
             default:
                 proto_tree_add_text(tree, tvb, start_offset, 0,
-                        "Unknown labeled VPN IPv6 address format %u", rd_type);
+                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
                 return -1;
-            }
-            break;
-
-        default:
-            proto_tree_add_text(tree, tvb, start_offset, 0,
-                    "Unknown SAFI (%u) for AFI %u", safi, afi);
-            return -1;
-        }
+        } /* switch (safi) */
         break;
 
     case AFNUM_L2VPN:
     case AFNUM_L2VPN_OLD:
         switch (safi) {
 
-        case SAFNUM_LAB_VPNUNICAST:
-        case SAFNUM_LAB_VPNMULCAST:
-        case SAFNUM_LAB_VPNUNIMULC:
-        case SAFNUM_VPLS:
-            plen =  tvb_get_ntohs(tvb,offset);
-            rd_type=tvb_get_ntohs(tvb,offset+2);
-            ce_id=tvb_get_ntohs(tvb,offset+10);
-            labblk_off=tvb_get_ntohs(tvb,offset+12);
-            labblk_size=tvb_get_ntohs(tvb,offset+14);
-            stack_strbuf = ep_strbuf_new_label(NULL);
-            labnum = decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
-
-            switch (rd_type) {
-
-            case FORMAT_AS2_LOC:
-                tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 6, 4);
-                proto_tree_add_text(tree, tvb, start_offset,
-                        (offset + plen + 1) - start_offset,
-                        "RD: %u:%s, CE-ID: %u, Label-Block Offset: %u, "
-                        "Label-Block Size: %u Label Base %s",
-                        tvb_get_ntohs(tvb, offset + 4),
-                        ip_to_str(ip4addr.addr_bytes),
-                        ce_id,
-                        labblk_off,
-                        labblk_size,
-                        stack_strbuf->str);
-                break;
+            case SAFNUM_LAB_VPNUNICAST:
+            case SAFNUM_LAB_VPNMULCAST:
+            case SAFNUM_LAB_VPNUNIMULC:
+            case SAFNUM_VPLS:
+                plen =  tvb_get_ntohs(tvb,offset);
+                rd_type=tvb_get_ntohs(tvb,offset+2);
+                ce_id=tvb_get_ntohs(tvb,offset+10);
+                labblk_off=tvb_get_ntohs(tvb,offset+12);
+                labblk_size=tvb_get_ntohs(tvb,offset+14);
+                stack_strbuf = ep_strbuf_new_label(NULL);
+                labnum = decode_MPLS_stack(tvb, offset + 16, stack_strbuf);
+
+                switch (rd_type) {
+
+                    case FORMAT_AS2_LOC:
+                        tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 6, 4);
+                        proto_tree_add_text(tree, tvb, start_offset,
+                                            (offset + plen + 1) - start_offset,
+                                            "RD: %u:%s, CE-ID: %u, Label-Block Offset: %u, "
+                                            "Label-Block Size: %u Label Base %s",
+                                            tvb_get_ntohs(tvb, offset + 4),
+                                            ip_to_str(ip4addr.addr_bytes),
+                                            ce_id,
+                                            labblk_off,
+                                            labblk_size,
+                                            stack_strbuf->str);
+                        break;
+
+                    case FORMAT_IP_LOC:
+                        tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 4, 4);
+                        proto_tree_add_text(tree, tvb, offset,
+                                            (offset + plen + 1) - start_offset,
+                                            "RD: %s:%u, CE-ID: %u, Label-Block Offset: %u, "
+                                            "Label-Block Size: %u, Label Base %s",
+                                            ip_to_str(ip4addr.addr_bytes),
+                                            tvb_get_ntohs(tvb, offset + 8),
+                                            ce_id,
+                                            labblk_off,
+                                            labblk_size,
+                                            stack_strbuf->str);
+                        break;
 
-            case FORMAT_IP_LOC:
-                tvb_memcpy(tvb, ip4addr.addr_bytes, offset + 4, 4);
-                proto_tree_add_text(tree, tvb, offset,
-                        (offset + plen + 1) - start_offset,
-                        "RD: %s:%u, CE-ID: %u, Label-Block Offset: %u, "
-                        "Label-Block Size: %u, Label Base %s",
-                        ip_to_str(ip4addr.addr_bytes),
-                        tvb_get_ntohs(tvb, offset + 8),
-                        ce_id,
-                        labblk_off,
-                        labblk_size,
-                        stack_strbuf->str);
+                    default:
+                        proto_tree_add_text(tree, tvb, start_offset,
+                                            (offset - start_offset) + 2,
+                                            "Unknown labeled VPN address format %u", rd_type);
+                        return -1;
+                } /* switch (rd_type) */
+                /* FIXME there are subTLVs left to decode ... for now lets omit them */
+                total_length = plen+2;
                 break;
 
             default:
-                proto_tree_add_text(tree, tvb, start_offset,
-                        (offset - start_offset) + 2,
-                        "Unknown labeled VPN address format %u", rd_type);
+                proto_tree_add_text(tree, tvb, start_offset, 0,
+                                    "Unknown SAFI (%u) for AFI %u", safi, afi);
                 return -1;
-            }
-            /* FIXME there are subTLVs left to decode ... for now lets omit them */
-            total_length = plen+2;
-            break;
+        } /* switch (safi) */
+        break;
 
         default:
             proto_tree_add_text(tree, tvb, start_offset, 0,
-                    "Unknown SAFI (%u) for AFI %u", safi, afi);
+                                "Unknown AFI (%u) value", afi);
             return -1;
-        }
-        break;
-
-    default:
-        proto_tree_add_text(tree, tvb, start_offset, 0,
-                "Unknown AFI (%u) value", afi);
-        return -1;
-    }
+    } /* switch (afi) */
     return(total_length);
 }
 
@@ -1117,220 +1117,220 @@ dissect_bgp_capability_item(tvbuff_t *tvb, int *p, proto_tree *tree, int ctype,
 
     /* check the capability type */
     switch (ctype) {
-    case BGP_CAPABILITY_RESERVED:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       proto_tree_add_text(tree, tvb, *p - 1,
-             1, "Capability length: %u byte%s", clen,
-             plurality(clen, "", "s"));
-       if (clen != 0) {
-           proto_tree_add_text(tree, tvb, *p,
-                 clen, "Capability value: Unknown");
-       }
-       *p += clen;
-       break;
-    case BGP_CAPABILITY_MULTIPROTOCOL:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       if (clen != 4) {
-           proto_tree_add_text(tree, tvb, *p - 1,
-                 1, "Capability length: Invalid");
-           proto_tree_add_text(tree, tvb, *p,
-                 clen, "Capability value: Unknown");
-       }
-       else {
-           proto_tree_add_text(tree, tvb, *p - 1,
-                 1, "Capability length: %u byte%s", clen,
-                 plurality(clen, "", "s"));
-           ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
-           subtree = proto_item_add_subtree(ti, ett_bgp_option);
-           /* AFI */
-           i = tvb_get_ntohs(tvb, *p);
-           proto_tree_add_text(subtree, tvb, *p,
-                 2, "Address family identifier: %s (%u)",
-                 val_to_str(i, afn_vals, "Unknown"), i);
-           *p += 2;
-           /* Reserved */
-           proto_tree_add_text(subtree, tvb, *p, 1, "Reserved: 1 byte");
-           (*p)++;
-           /* SAFI */
-           i = tvb_get_guint8(tvb, *p);
-           proto_tree_add_text(subtree, tvb, *p,
-                 1, "Subsequent address family identifier: %s (%u)",
-                 val_to_str(i, bgpattr_nlri_safi,
-                 i >= 128 ? "Vendor specific" : "Unknown"), i);
-           (*p)++;
-       }
-       break;
-    case BGP_CAPABILITY_GRACEFUL_RESTART:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       if (clen < 6) {
-           proto_tree_add_text(tree, tvb, *p,
-                 clen, "Capability value: Invalid");
-           *p += clen;
-       }
-       else {
-           proto_tree_add_text(tree, tvb, *p - 1,
-                 1, "Capability length: %u byte%s", clen,
-                plurality(clen, "", "s"));
-           ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
-           subtree = proto_item_add_subtree(ti, ett_bgp_option);
-           /* Timers */
-           i = tvb_get_ntohs(tvb, *p);
-           proto_tree_add_text(subtree, tvb, *p,
-                 2, "Restart Flags: [%s], Restart Time %us",
-                 (i&0x8000) ? "R" : "none", i&0xfff);
-           *p += 2;
-           tclen = clen - 2;
-           /*
-            * what follows is alist of AFI/SAFI/flag triplets
-            * read it until the TLV ends
-            */
-           while (tclen >=4) {
-               /* AFI */
-               i = tvb_get_ntohs(tvb, *p);
-               proto_tree_add_text(subtree, tvb, *p,
-                     2, "Address family identifier: %s (%u)",
-                     val_to_str(i, afn_vals, "Unknown"), i);
-               *p += 2;
-               /* SAFI */
-               i = tvb_get_guint8(tvb, *p);
-               proto_tree_add_text(subtree, tvb, *p,
-                     1, "Subsequent address family identifier: %s (%u)",
-                     val_to_str(i, bgpattr_nlri_safi,
-                     i >= 128 ? "Vendor specific" : "Unknown"), i);
-               (*p)++;
-               /* flags */
-               i = tvb_get_guint8(tvb, *p);
-               proto_tree_add_text(subtree, tvb, *p, 1,
-                    "Preserve forwarding state: %s",
-                     (i&0x80) ? "yes" : "no");
-               (*p)++;
-               tclen-=4;
-           }
-       }
-       break;
-    case BGP_CAPABILITY_4_OCTET_AS_NUMBER:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       if (clen != 4) {
-           proto_tree_add_text(tree, tvb, *p,
-                 clen, "Capability value: Invalid");
-       }
-       else {
-           proto_tree_add_text(tree, tvb, *p - 1,
-                 1, "Capability length: %u byte%s", clen,
-                 plurality(clen, "", "s"));
-           ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
-           subtree = proto_item_add_subtree(ti, ett_bgp_option);
-           proto_tree_add_text(subtree, tvb, *p, 4,
-                "AS number: %d", tvb_get_ntohl(tvb, *p));
-       }
-       *p += clen;
-       break;
-    case BGP_CAPABILITY_DYNAMIC_CAPABILITY:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       proto_tree_add_text(tree, tvb, *p - 1, 1,
-             "Capability length: %u byte%s", clen,
-             plurality(clen, "", "s"));
-       if (clen > 0) {
-           ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
-           subtree = proto_item_add_subtree(ti, ett_bgp_option);
-           for (i = 0; (int)i <= clen; i++) {
-               proto_tree_add_text(subtree, tvb, *p, 1,
-                    "Capability code: %s (%d)", val_to_str(ctype,
-                    capability_vals, "Unknown capability"),
-                    tvb_get_guint8(tvb, *p));
-               (*p)++;
-           }
-       }
-       break;
-    case BGP_CAPABILITY_ROUTE_REFRESH_CISCO:
-    case BGP_CAPABILITY_ROUTE_REFRESH:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       if (clen != 0) {
-           proto_tree_add_text(tree, tvb, *p,
-                 clen, "Capability value: Invalid");
-       }
-       else {
-           proto_tree_add_text(tree, tvb, *p - 1,
-                 1, "Capability length: %u byte%s", clen,
-                 plurality(clen, "", "s"));
-       }
-       *p += clen;
-       break;
-    case BGP_CAPABILITY_ORF_CISCO:
-    case BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       proto_tree_add_text(tree, tvb, *p - 1,
-            1, "Capability length: %u byte%s", clen,
-            plurality(clen, "", "s"));
-       ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
-       subtree = proto_item_add_subtree(ti, ett_bgp_option);
-       /* AFI */
-       i = tvb_get_ntohs(tvb, *p);
-       proto_tree_add_text(subtree, tvb, *p,
-            2, "Address family identifier: %s (%u)",
-             val_to_str(i, afn_vals, "Unknown"), i);
-       *p += 2;
-       /* Reserved */
-       proto_tree_add_text(subtree, tvb, *p, 1, "Reserved: 1 byte");
-       (*p)++;
-       /* SAFI */
-       i = tvb_get_guint8(tvb, *p);
-       proto_tree_add_text(subtree, tvb, *p,
-            1, "Subsequent address family identifier: %s (%u)",
-            val_to_str(i, bgpattr_nlri_safi,
-            i >= 128 ? "Vendor specific" : "Unknown"), i);
-       (*p)++;
-       /* Number of ORFs */
-       orfnum = tvb_get_guint8(tvb, *p);
-       proto_tree_add_text(subtree, tvb, *p, 1, "Number of ORFs: %u", orfnum);
-       (*p)++;
-       for (i=0; i<orfnum; i++) {
-           /* ORF Type */
-           orftype = tvb_get_guint8(tvb, *p);
-           proto_tree_add_text(subtree, tvb, *p, 1, "ORF Type: %s (%u)",
-                val_to_str(orftype, orf_type_vals,"Unknown"), orftype);
-           (*p)++;
-           /* Send/Receive */
-           orfsendrecv = tvb_get_guint8(tvb, *p);
-           proto_tree_add_text(subtree, tvb, *p,
-                1, "Send/Receive: %s (%u)",
-                val_to_str(orfsendrecv, orf_send_recv_vals,
-                "Uknown"), orfsendrecv);
-           (*p)++;
-       }
-       break;
-       /* unknown capability */
-    default:
-       proto_tree_add_text(tree, tvb, *p - 2, 1,
-            "Capability code: %s (%d)", val_to_str(ctype,
-            capability_vals, "Unknown capability"), ctype);
-       proto_tree_add_text(tree, tvb, *p - 2,
-            1, "Capability code: %s (%d)",
-             ctype >= 128 ? "Private use" : "Unknown", ctype);
-       proto_tree_add_text(tree, tvb, *p - 1,
-             1, "Capability length: %u byte%s", clen,
-             plurality(clen, "", "s"));
-       if (clen != 0) {
-           proto_tree_add_text(tree, tvb, *p,
-                 clen, "Capability value: Unknown");
-       }
-       *p += clen;
-       break;
-    }
+        case BGP_CAPABILITY_RESERVED:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            proto_tree_add_text(tree, tvb, *p - 1,
+                                1, "Capability length: %u byte%s", clen,
+                                plurality(clen, "", "s"));
+            if (clen != 0) {
+                proto_tree_add_text(tree, tvb, *p,
+                                    clen, "Capability value: Unknown");
+            }
+            *p += clen;
+            break;
+        case BGP_CAPABILITY_MULTIPROTOCOL:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            if (clen != 4) {
+                proto_tree_add_text(tree, tvb, *p - 1,
+                                    1, "Capability length: Invalid");
+                proto_tree_add_text(tree, tvb, *p,
+                                    clen, "Capability value: Unknown");
+            }
+            else {
+                proto_tree_add_text(tree, tvb, *p - 1,
+                                    1, "Capability length: %u byte%s", clen,
+                                    plurality(clen, "", "s"));
+                ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
+                subtree = proto_item_add_subtree(ti, ett_bgp_option);
+                /* AFI */
+                i = tvb_get_ntohs(tvb, *p);
+                proto_tree_add_text(subtree, tvb, *p,
+                                    2, "Address family identifier: %s (%u)",
+                                    val_to_str(i, afn_vals, "Unknown"), i);
+                *p += 2;
+                /* Reserved */
+                proto_tree_add_text(subtree, tvb, *p, 1, "Reserved: 1 byte");
+                (*p)++;
+                /* SAFI */
+                i = tvb_get_guint8(tvb, *p);
+                proto_tree_add_text(subtree, tvb, *p,
+                                    1, "Subsequent address family identifier: %s (%u)",
+                                    val_to_str(i, bgpattr_nlri_safi,
+                                               i >= 128 ? "Vendor specific" : "Unknown"), i);
+                (*p)++;
+            }
+            break;
+        case BGP_CAPABILITY_GRACEFUL_RESTART:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            if (clen < 6) {
+                proto_tree_add_text(tree, tvb, *p,
+                                    clen, "Capability value: Invalid");
+                *p += clen;
+            }
+            else {
+                proto_tree_add_text(tree, tvb, *p - 1,
+                                    1, "Capability length: %u byte%s", clen,
+                                    plurality(clen, "", "s"));
+                ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
+                subtree = proto_item_add_subtree(ti, ett_bgp_option);
+                /* Timers */
+                i = tvb_get_ntohs(tvb, *p);
+                proto_tree_add_text(subtree, tvb, *p,
+                                    2, "Restart Flags: [%s], Restart Time %us",
+                                    (i&0x8000) ? "R" : "none", i&0xfff);
+                *p += 2;
+                tclen = clen - 2;
+                /*
+                 * what follows is alist of AFI/SAFI/flag triplets
+                 * read it until the TLV ends
+                 */
+                while (tclen >=4) {
+                    /* AFI */
+                    i = tvb_get_ntohs(tvb, *p);
+                    proto_tree_add_text(subtree, tvb, *p,
+                                        2, "Address family identifier: %s (%u)",
+                                        val_to_str(i, afn_vals, "Unknown"), i);
+                    *p += 2;
+                    /* SAFI */
+                    i = tvb_get_guint8(tvb, *p);
+                    proto_tree_add_text(subtree, tvb, *p,
+                                        1, "Subsequent address family identifier: %s (%u)",
+                                        val_to_str(i, bgpattr_nlri_safi,
+                                                   i >= 128 ? "Vendor specific" : "Unknown"), i);
+                    (*p)++;
+                    /* flags */
+                    i = tvb_get_guint8(tvb, *p);
+                    proto_tree_add_text(subtree, tvb, *p, 1,
+                                        "Preserve forwarding state: %s",
+                                        (i&0x80) ? "yes" : "no");
+                    (*p)++;
+                    tclen-=4;
+                }
+            }
+            break;
+        case BGP_CAPABILITY_4_OCTET_AS_NUMBER:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            if (clen != 4) {
+                proto_tree_add_text(tree, tvb, *p,
+                                    clen, "Capability value: Invalid");
+            }
+            else {
+                proto_tree_add_text(tree, tvb, *p - 1,
+                                    1, "Capability length: %u byte%s", clen,
+                                    plurality(clen, "", "s"));
+                ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
+                subtree = proto_item_add_subtree(ti, ett_bgp_option);
+                proto_tree_add_text(subtree, tvb, *p, 4,
+                                    "AS number: %d", tvb_get_ntohl(tvb, *p));
+            }
+            *p += clen;
+            break;
+        case BGP_CAPABILITY_DYNAMIC_CAPABILITY:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            proto_tree_add_text(tree, tvb, *p - 1, 1,
+                                "Capability length: %u byte%s", clen,
+                                plurality(clen, "", "s"));
+            if (clen > 0) {
+                ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
+                subtree = proto_item_add_subtree(ti, ett_bgp_option);
+                for (i = 0; (int)i <= clen; i++) {
+                    proto_tree_add_text(subtree, tvb, *p, 1,
+                                        "Capability code: %s (%d)", val_to_str(ctype,
+                                                                               capability_vals, "Unknown capability"),
+                                        tvb_get_guint8(tvb, *p));
+                    (*p)++;
+                }
+            }
+            break;
+        case BGP_CAPABILITY_ROUTE_REFRESH_CISCO:
+        case BGP_CAPABILITY_ROUTE_REFRESH:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            if (clen != 0) {
+                proto_tree_add_text(tree, tvb, *p,
+                                    clen, "Capability value: Invalid");
+            }
+            else {
+                proto_tree_add_text(tree, tvb, *p - 1,
+                                    1, "Capability length: %u byte%s", clen,
+                                    plurality(clen, "", "s"));
+            }
+            *p += clen;
+            break;
+        case BGP_CAPABILITY_ORF_CISCO:
+        case BGP_CAPABILITY_COOPERATIVE_ROUTE_FILTERING:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            proto_tree_add_text(tree, tvb, *p - 1,
+                                1, "Capability length: %u byte%s", clen,
+                                plurality(clen, "", "s"));
+            ti = proto_tree_add_text(tree, tvb, *p, clen, "Capability value");
+            subtree = proto_item_add_subtree(ti, ett_bgp_option);
+            /* AFI */
+            i = tvb_get_ntohs(tvb, *p);
+            proto_tree_add_text(subtree, tvb, *p,
+                                2, "Address family identifier: %s (%u)",
+                                val_to_str(i, afn_vals, "Unknown"), i);
+            *p += 2;
+            /* Reserved */
+            proto_tree_add_text(subtree, tvb, *p, 1, "Reserved: 1 byte");
+            (*p)++;
+            /* SAFI */
+            i = tvb_get_guint8(tvb, *p);
+            proto_tree_add_text(subtree, tvb, *p,
+                                1, "Subsequent address family identifier: %s (%u)",
+                                val_to_str(i, bgpattr_nlri_safi,
+                                           i >= 128 ? "Vendor specific" : "Unknown"), i);
+            (*p)++;
+            /* Number of ORFs */
+            orfnum = tvb_get_guint8(tvb, *p);
+            proto_tree_add_text(subtree, tvb, *p, 1, "Number of ORFs: %u", orfnum);
+            (*p)++;
+            for (i=0; i<orfnum; i++) {
+                /* ORF Type */
+                orftype = tvb_get_guint8(tvb, *p);
+                proto_tree_add_text(subtree, tvb, *p, 1, "ORF Type: %s (%u)",
+                                    val_to_str(orftype, orf_type_vals,"Unknown"), orftype);
+                (*p)++;
+                /* Send/Receive */
+                orfsendrecv = tvb_get_guint8(tvb, *p);
+                proto_tree_add_text(subtree, tvb, *p,
+                                    1, "Send/Receive: %s (%u)",
+                                    val_to_str(orfsendrecv, orf_send_recv_vals,
+                                               "Uknown"), orfsendrecv);
+                (*p)++;
+            }
+            break;
+            /* unknown capability */
+        default:
+            proto_tree_add_text(tree, tvb, *p - 2, 1,
+                                "Capability code: %s (%d)", val_to_str(ctype,
+                                                                       capability_vals, "Unknown capability"), ctype);
+            proto_tree_add_text(tree, tvb, *p - 2,
+                                1, "Capability code: %s (%d)",
+                                ctype >= 128 ? "Private use" : "Unknown", ctype);
+            proto_tree_add_text(tree, tvb, *p - 1,
+                                1, "Capability length: %u byte%s", clen,
+                                plurality(clen, "", "s"));
+            if (clen != 0) {
+                proto_tree_add_text(tree, tvb, *p,
+                                    clen, "Capability value: Unknown");
+            }
+            *p += clen;
+            break;
+    } /* switch (ctype) */
 }
 
 
@@ -1338,10 +1338,10 @@ dissect_bgp_capability_item(tvbuff_t *tvb, int *p, proto_tree *tree, int ctype,
  * Dissect a BGP OPEN message.
  */
 static const value_string community_vals[] = {
-       { BGP_COMM_NO_EXPORT,           "NO_EXPORT" },
-       { BGP_COMM_NO_ADVERTISE,        "NO_ADVERTISE" },
-       { BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
-       { 0,                            NULL }
+    { BGP_COMM_NO_EXPORT,           "NO_EXPORT" },
+    { BGP_COMM_NO_ADVERTISE,        "NO_ADVERTISE" },
+    { BGP_COMM_NO_EXPORT_SUBCONFED, "NO_EXPORT_SUBCONFED" },
+    { 0,                            NULL }
 };
 
 static void
@@ -1402,46 +1402,46 @@ dissect_bgp_open(tvbuff_t *tvb, proto_tree *tree)
 
             /* check the type */
             switch (ptype) {
-            case BGP_OPTION_AUTHENTICATION:
-                proto_tree_add_text(subtree, tvb, p - 2, 2 + plen,
-                    "Authentication information (%u byte%s)", plen,
-                    plurality(plen, "", "s"));
-                break;
-            case BGP_OPTION_CAPABILITY:
-                /* grab the capability code */
-               cend = p - 1 + plen;
-                ctype = tvb_get_guint8(tvb, p++);
-                clen = tvb_get_guint8(tvb, p++);
-               ti = proto_tree_add_text(subtree, tvb, p - 4,
-                     2 + plen, "Capabilities Advertisement (%u bytes)",
-                    2 + plen);
-               subtree1 = proto_item_add_subtree(ti, ett_bgp_option);
-               proto_tree_add_text(subtree1, tvb, p - 4,
-                     1, "Parameter type: Capabilities (2)");
-               proto_tree_add_text(subtree1, tvb, p - 3,
-                     1, "Parameter length: %u byte%s", plen,
-                     plurality(plen, "", "s"));
-               p -= 2;
-
-               /* step through all of the capabilities */
-               while (p < cend) {
-                   ctype = tvb_get_guint8(tvb, p++);
-                   clen = tvb_get_guint8(tvb, p++);
-
-                   ti = proto_tree_add_text(subtree1, tvb, p - 2,
-                         2 + clen, "%s (%u byte%s)", val_to_str(ctype,
-                        capability_vals, "Unknown capability"),
-                        2 + clen, plurality(clen, "", "s"));
-                   subtree2 = proto_item_add_subtree(ti, ett_bgp_option);
-                   dissect_bgp_capability_item(tvb, &p,
-                          subtree2, ctype, clen);
-               }
-                break;
-            default:
-                proto_tree_add_text(subtree, tvb, p - 2, 2 + plen,
-                    "Unknown optional parameter");
-                break;
-            }
+                case BGP_OPTION_AUTHENTICATION:
+                    proto_tree_add_text(subtree, tvb, p - 2, 2 + plen,
+                                        "Authentication information (%u byte%s)", plen,
+                                        plurality(plen, "", "s"));
+                    break;
+                case BGP_OPTION_CAPABILITY:
+                    /* grab the capability code */
+                    cend = p - 1 + plen;
+                    ctype = tvb_get_guint8(tvb, p++);
+                    clen = tvb_get_guint8(tvb, p++);
+                    ti = proto_tree_add_text(subtree, tvb, p - 4,
+                                             2 + plen, "Capabilities Advertisement (%u bytes)",
+                                             2 + plen);
+                    subtree1 = proto_item_add_subtree(ti, ett_bgp_option);
+                    proto_tree_add_text(subtree1, tvb, p - 4,
+                                        1, "Parameter type: Capabilities (2)");
+                    proto_tree_add_text(subtree1, tvb, p - 3,
+                                        1, "Parameter length: %u byte%s", plen,
+                                        plurality(plen, "", "s"));
+                    p -= 2;
+
+                    /* step through all of the capabilities */
+                    while (p < cend) {
+                        ctype = tvb_get_guint8(tvb, p++);
+                        clen = tvb_get_guint8(tvb, p++);
+
+                        ti = proto_tree_add_text(subtree1, tvb, p - 2,
+                                                 2 + clen, "%s (%u byte%s)", val_to_str(ctype,
+                                                                                        capability_vals, "Unknown capability"),
+                                                 2 + clen, plurality(clen, "", "s"));
+                        subtree2 = proto_item_add_subtree(ti, ett_bgp_option);
+                        dissect_bgp_capability_item(tvb, &p,
+                                                    subtree2, ctype, clen);
+                    }
+                    break;
+                default:
+                    proto_tree_add_text(subtree, tvb, p - 2, 2 + plen,
+                                        "Unknown optional parameter");
+                    break;
+            } /* switch (ptype) */
         }
     }
 }
@@ -1552,259 +1552,259 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
                helps browsing attrs.                                      */
             /* the first switch prints things in the title of the subtree */
            switch (bgpa.bgpa_type) {
-           case BGPTYPE_ORIGIN:
-               if (tlen != 1)
-                   goto default_attribute_top;
-               msg = val_to_str(tvb_get_guint8(tvb, o + i + aoff), bgpattr_origin, "Unknown");
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       msg, tlen + aoff, plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_AS_PATH:
-           case BGPTYPE_NEW_AS_PATH:
-                /* (o + i + aoff) =
-                   (o + current attribute + aoff bytes to first tuple) */
-                q = o + i + aoff;
-                end = q + tlen;
-                /* must be freed by second switch!                         */
-                /* "tlen * 11" (10 digits + space) should be a good estimate
-                   of how long the AS path string could be                 */
-               if (as_path_emstr == NULL)
-                   as_path_emstr = ep_strbuf_sized_new((tlen + 1) * 11, 0);
-                ep_strbuf_truncate(as_path_emstr, 0);
-
-               /* estimate the length of the AS number */
-               if (bgpa.bgpa_type == BGPTYPE_NEW_AS_PATH)
-                   asn_len = 4;
-               else {
-                   if (bgp_asn_len == 0) {
-                       k = q;
-                       while (k < end) {
-                           k++;
-                           length = tvb_get_guint8(tvb, k++);
-                           k += length * 2;
-                       }
-                       asn_len = (k == end) ? 2 : 4;
-                   }
-                   else {
-                       asn_len = bgp_asn_len;
-                   }
-               }
-
-                /* snarf each AS path */
-                while (q < end) {
-                   type = tvb_get_guint8(tvb, q++);
-                   if (as_path_emstr->len > 1 &&
-                       as_path_emstr->str[as_path_emstr->len - 1] != ' ')
-                       ep_strbuf_append_c(as_path_emstr, ' ');
-                    if (type == AS_SET) {
-                        ep_strbuf_append_c(as_path_emstr, '{');
-                    }
-                    else if (type == AS_CONFED_SET) {
-                       ep_strbuf_append_c(as_path_emstr, '[');
-                    }
-                    else if (type == AS_CONFED_SEQUENCE) {
-                       ep_strbuf_append_c(as_path_emstr, '(');
-                   }
-                   length = tvb_get_guint8(tvb, q++);
-
-                    /* snarf each value in path */
-                    for (j = 0; j < length; j++) {
-                       ep_strbuf_append_printf(as_path_emstr, "%u%s",
-                               (asn_len == 2) ?
-                               tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
-                               (type == AS_SET || type == AS_CONFED_SET) ?
-                               ", " : " ");
-                        q += asn_len;
+                case BGPTYPE_ORIGIN:
+                    if (tlen != 1)
+                        goto default_attribute_top;
+                    msg = val_to_str(tvb_get_guint8(tvb, o + i + aoff), bgpattr_origin, "Unknown");
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             msg, tlen + aoff, plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_AS_PATH:
+                case BGPTYPE_NEW_AS_PATH:
+                    /* (o + i + aoff) =
+                       (o + current attribute + aoff bytes to first tuple) */
+                    q = o + i + aoff;
+                    end = q + tlen;
+                    /* must be freed by second switch!                         */
+                    /* "tlen * 11" (10 digits + space) should be a good estimate
+                       of how long the AS path string could be                 */
+                    if (as_path_emstr == NULL)
+                        as_path_emstr = ep_strbuf_sized_new((tlen + 1) * 11, 0);
+                    ep_strbuf_truncate(as_path_emstr, 0);
+
+                    /* estimate the length of the AS number */
+                    if (bgpa.bgpa_type == BGPTYPE_NEW_AS_PATH)
+                        asn_len = 4;
+                    else {
+                        if (bgp_asn_len == 0) {
+                            k = q;
+                            while (k < end) {
+                                k++;
+                                length = tvb_get_guint8(tvb, k++);
+                                k += length * 2;
+                            }
+                            asn_len = (k == end) ? 2 : 4;
+                        }
+                        else {
+                            asn_len = bgp_asn_len;
+                        }
                     }
 
-                    /* cleanup end of string */
-                    if (type == AS_SET) {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
-                       ep_strbuf_append_c(as_path_emstr, '}');
-                    }
-                    else if (type == AS_CONFED_SET) {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
-                       ep_strbuf_append_c(as_path_emstr, ']');
-                    }
-                    else if (type == AS_CONFED_SEQUENCE) {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
-                       ep_strbuf_append_c(as_path_emstr, ')');
+                    /* snarf each AS path */
+                    while (q < end) {
+                        type = tvb_get_guint8(tvb, q++);
+                        if (as_path_emstr->len > 1 &&
+                            as_path_emstr->str[as_path_emstr->len - 1] != ' ')
+                            ep_strbuf_append_c(as_path_emstr, ' ');
+                        if (type == AS_SET) {
+                            ep_strbuf_append_c(as_path_emstr, '{');
+                        }
+                        else if (type == AS_CONFED_SET) {
+                            ep_strbuf_append_c(as_path_emstr, '[');
+                        }
+                        else if (type == AS_CONFED_SEQUENCE) {
+                            ep_strbuf_append_c(as_path_emstr, '(');
+                        }
+                        length = tvb_get_guint8(tvb, q++);
+
+                        /* snarf each value in path */
+                        for (j = 0; j < length; j++) {
+                            ep_strbuf_append_printf(as_path_emstr, "%u%s",
+                                                    (asn_len == 2) ?
+                                                    tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
+                                                    (type == AS_SET || type == AS_CONFED_SET) ?
+                                                    ", " : " ");
+                            q += asn_len;
+                        }
+
+                        /* cleanup end of string */
+                        if (type == AS_SET) {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
+                            ep_strbuf_append_c(as_path_emstr, '}');
+                        }
+                        else if (type == AS_CONFED_SET) {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
+                            ep_strbuf_append_c(as_path_emstr, ']');
+                        }
+                        else if (type == AS_CONFED_SEQUENCE) {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
+                            ep_strbuf_append_c(as_path_emstr, ')');
+                        }
+                        else {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
+                        }
                     }
-                    else {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
+
+                    /* check for empty AS_PATH */
+                    if (tlen == 0)
+                        ep_strbuf_printf(as_path_emstr, "empty");
+
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             as_path_emstr->str, tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_NEXT_HOP:
+                    if (tlen != 4)
+                        goto default_attribute_top;
+                    ipaddr = tvb_get_ipv4(tvb, o + i + aoff);
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             ip_to_str((guint8 *)&ipaddr), tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_MULTI_EXIT_DISC:
+                    if (tlen != 4)
+                        goto default_attribute_top;
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %u (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             tvb_get_ntohl(tvb, o + i + aoff), tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_LOCAL_PREF:
+                    if (tlen != 4)
+                        goto default_attribute_top;
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %u (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             tvb_get_ntohl(tvb, o + i + aoff), tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_ATOMIC_AGGREGATE:
+                    if (tlen != 0)
+                        goto default_attribute_top;
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             tlen + aoff, plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_AGGREGATOR:
+                    if (tlen != 6 && tlen != 8)
+                        goto default_attribute_top;
+                case BGPTYPE_NEW_AGGREGATOR:
+                    if (bgpa.bgpa_type == BGPTYPE_NEW_AGGREGATOR && tlen != 8)
+                        goto default_attribute_top;
+                    asn_len = tlen - 4;
+                    ipaddr = tvb_get_ipv4(tvb, o + i + aoff + asn_len);
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: AS: %u origin: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             (asn_len == 2) ? tvb_get_ntohs(tvb, o + i + aoff) :
+                                             tvb_get_ntohl(tvb, o + i + aoff),
+                                             ip_to_str((guint8 *)&ipaddr),
+                                             tlen + aoff, plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_COMMUNITIES:
+                    if (tlen % 4 != 0)
+                        goto default_attribute_top;
+
+                    /* (o + i + aoff) =
+                       (o + current attribute + aoff bytes to first tuple) */
+                    q = o + i + aoff;
+                    end = q + tlen;
+                    /* must be freed by second switch!                          */
+                    /* "tlen * 12" (5 digits, a :, 5 digits + space ) should be
+                       a good estimate of how long the communities string could
+                       be                                                       */
+                    if (communities_emstr == NULL)
+                        communities_emstr = ep_strbuf_sized_new((tlen + 1) * 12, 0);
+                    ep_strbuf_truncate(communities_emstr, 0);
+
+                    /* snarf each community */
+                    while (q < end) {
+                        /* check for well-known communities */
+                        if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT)
+                            ep_strbuf_append(communities_emstr, "NO_EXPORT ");
+                        else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_ADVERTISE)
+                            ep_strbuf_append(communities_emstr, "NO_ADVERTISE ");
+                        else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT_SUBCONFED)
+                            ep_strbuf_append(communities_emstr, "NO_EXPORT_SUBCONFED ");
+                        else {
+                            ep_strbuf_append_printf(communities_emstr, "%u:%u ",
+                                                    tvb_get_ntohs(tvb, q),
+                                                    tvb_get_ntohs(tvb, q + 2));
+                        }
+                        q += 4;
                     }
-                }
+                    /* cleanup end of string */
+                    ep_strbuf_truncate(communities_emstr, communities_emstr->len - 1);
 
-                /* check for empty AS_PATH */
-               if (tlen == 0)
-                    ep_strbuf_printf(as_path_emstr, "empty");
-
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                        "%s: %s (%u byte%s)",
-                        val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                        as_path_emstr->str, tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_NEXT_HOP:
-               if (tlen != 4)
-                   goto default_attribute_top;
-               ipaddr = tvb_get_ipv4(tvb, o + i + aoff);
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       ip_to_str((guint8 *)&ipaddr), tlen + aoff,
-                       plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_MULTI_EXIT_DISC:
-               if (tlen != 4)
-                   goto default_attribute_top;
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %u (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       tvb_get_ntohl(tvb, o + i + aoff), tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_LOCAL_PREF:
-               if (tlen != 4)
-                   goto default_attribute_top;
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %u (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       tvb_get_ntohl(tvb, o + i + aoff), tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-               break;
-            case BGPTYPE_ATOMIC_AGGREGATE:
-                if (tlen != 0)
-                   goto default_attribute_top;
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       tlen + aoff, plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_AGGREGATOR:
-               if (tlen != 6 && tlen != 8)
-                   goto default_attribute_top;
-           case BGPTYPE_NEW_AGGREGATOR:
-                if (bgpa.bgpa_type == BGPTYPE_NEW_AGGREGATOR && tlen != 8)
-                   goto default_attribute_top;
-               asn_len = tlen - 4;
-               ipaddr = tvb_get_ipv4(tvb, o + i + aoff + asn_len);
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: AS: %u origin: %s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       (asn_len == 2) ? tvb_get_ntohs(tvb, o + i + aoff) :
-                       tvb_get_ntohl(tvb, o + i + aoff),
-                       ip_to_str((guint8 *)&ipaddr),
-                       tlen + aoff, plurality(tlen + aoff, "", "s"));
-               break;
-            case BGPTYPE_COMMUNITIES:
-               if (tlen % 4 != 0)
-                   goto default_attribute_top;
-
-                /* (o + i + aoff) =
-                   (o + current attribute + aoff bytes to first tuple) */
-                q = o + i + aoff;
-                end = q + tlen;
-                /* must be freed by second switch!                          */
-                /* "tlen * 12" (5 digits, a :, 5 digits + space ) should be
-                   a good estimate of how long the communities string could
-                   be                                                       */
-               if (communities_emstr == NULL)
-                   communities_emstr = ep_strbuf_sized_new((tlen + 1) * 12, 0);
-               ep_strbuf_truncate(communities_emstr, 0);
-
-                /* snarf each community */
-                while (q < end) {
-                    /* check for well-known communities */
-                   if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT)
-                        ep_strbuf_append(communities_emstr, "NO_EXPORT ");
-                   else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_ADVERTISE)
-                        ep_strbuf_append(communities_emstr, "NO_ADVERTISE ");
-                   else if (tvb_get_ntohl(tvb, q) == BGP_COMM_NO_EXPORT_SUBCONFED)
-                        ep_strbuf_append(communities_emstr, "NO_EXPORT_SUBCONFED ");
-                    else {
-                        ep_strbuf_append_printf(communities_emstr, "%u:%u ",
-                               tvb_get_ntohs(tvb, q),
-                                tvb_get_ntohs(tvb, q + 2));
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             communities_emstr->str, tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_ORIGINATOR_ID:
+                    if (tlen != 4)
+                        goto default_attribute_top;
+                    ipaddr = tvb_get_ipv4(tvb, o + i + aoff);
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             ip_to_str((guint8 *)&ipaddr),
+                                             tlen + aoff, plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_CLUSTER_LIST:
+                    if (tlen % 4 != 0)
+                        goto default_attribute_top;
+
+                    /* (o + i + aoff) =
+                       (o + current attribute + aoff bytes to first tuple) */
+                    q = o + i + aoff;
+                    end = q + tlen;
+                    /* must be freed by second switch!                          */
+                    /* "tlen * 16" (12 digits, 3 dots + space ) should be
+                       a good estimate of how long the cluster_list string could
+                       be                                                       */
+                    if (cluster_list_emstr == NULL)
+                        cluster_list_emstr = ep_strbuf_sized_new((tlen + 1) * 16, 0);
+                    ep_strbuf_truncate(cluster_list_emstr, 0);
+
+                    /* snarf each cluster list */
+                    while (q < end) {
+                        ipaddr = tvb_get_ipv4(tvb, q);
+                        ep_strbuf_append_printf(cluster_list_emstr, "%s ", ip_to_str((guint8 *)&ipaddr));
+                        q += 4;
                     }
-                    q += 4;
-                }
-                /* cleanup end of string */
-                ep_strbuf_truncate(communities_emstr, communities_emstr->len - 1);
-
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                        communities_emstr->str, tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_ORIGINATOR_ID:
-               if (tlen != 4)
-                   goto default_attribute_top;
-               ipaddr = tvb_get_ipv4(tvb, o + i + aoff);
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       ip_to_str((guint8 *)&ipaddr),
-                       tlen + aoff, plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_CLUSTER_LIST:
-               if (tlen % 4 != 0)
-                   goto default_attribute_top;
-
-                /* (o + i + aoff) =
-                   (o + current attribute + aoff bytes to first tuple) */
-                q = o + i + aoff;
-                end = q + tlen;
-                /* must be freed by second switch!                          */
-                /* "tlen * 16" (12 digits, 3 dots + space ) should be
-                   a good estimate of how long the cluster_list string could
-                   be                                                       */
-               if (cluster_list_emstr == NULL)
-                    cluster_list_emstr = ep_strbuf_sized_new((tlen + 1) * 16, 0);
-                ep_strbuf_truncate(cluster_list_emstr, 0);
-
-                /* snarf each cluster list */
-                while (q < end) {
-                   ipaddr = tvb_get_ipv4(tvb, q);
-                    ep_strbuf_append_printf(cluster_list_emstr, "%s ", ip_to_str((guint8 *)&ipaddr));
-                    q += 4;
-                }
-                /* cleanup end of string */
-                ep_strbuf_truncate(cluster_list_emstr, cluster_list_emstr->len - 1);
-
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s: %s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                        cluster_list_emstr->str, tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-               break;
-           case BGPTYPE_EXTENDED_COMMUNITY:
-               if (tlen %8 != 0)
-                   break;
-                ti = proto_tree_add_text(subtree,tvb,o+i,tlen+aoff,
-                        "%s: (%u byte%s)",
-                        val_to_str(bgpa.bgpa_type,bgpattr_type,"Unknown"),
-                        tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-                break;
-            case BGPTYPE_SAFI_SPECIFIC_ATTR:
-                ti = proto_tree_add_text(subtree,tvb,o+i,tlen+aoff,
-                        "%s: (%u byte%s)",
-                        val_to_str(bgpa.bgpa_type,bgpattr_type,"Unknown"),
-                        tlen + aoff,
-                        plurality(tlen + aoff, "", "s"));
-                break;
+                    /* cleanup end of string */
+                    ep_strbuf_truncate(cluster_list_emstr, cluster_list_emstr->len - 1);
+
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s: %s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             cluster_list_emstr->str, tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_EXTENDED_COMMUNITY:
+                    if (tlen %8 != 0)
+                        break;
+                    ti = proto_tree_add_text(subtree,tvb,o+i,tlen+aoff,
+                                             "%s: (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type,bgpattr_type,"Unknown"),
+                                             tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
+                case BGPTYPE_SAFI_SPECIFIC_ATTR:
+                    ti = proto_tree_add_text(subtree,tvb,o+i,tlen+aoff,
+                                             "%s: (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type,bgpattr_type,"Unknown"),
+                                             tlen + aoff,
+                                             plurality(tlen + aoff, "", "s"));
+                    break;
 
-           default:
-           default_attribute_top:
-               ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
-                       "%s (%u byte%s)",
-                       val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
-                       tlen + aoff, plurality(tlen + aoff, "", "s"));
-           } /* end of first switch */
+                default:
+                default_attribute_top:
+                    ti = proto_tree_add_text(subtree, tvb, o + i, tlen + aoff,
+                                             "%s (%u byte%s)",
+                                             val_to_str(bgpa.bgpa_type, bgpattr_type, "Unknown"),
+                                             tlen + aoff, plurality(tlen + aoff, "", "s"));
+           } /* switch (bgpa.bgpa_type) */ /* end of first switch */
            subtree2 = proto_item_add_subtree(ti, ett_bgp_attr);
 
             /* figure out flags */
@@ -1868,393 +1868,393 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
             /* the second switch prints things in the actual subtree of each
                attribute                                                     */
            switch (bgpa.bgpa_type) {
-           case BGPTYPE_ORIGIN:
-               if (tlen != 1) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Origin (invalid): %u byte%s", tlen,
-                             plurality(tlen, "", "s"));
-               } else {
-                   proto_tree_add_item(subtree2, hf_bgp_origin, tvb,
-                           o + i + aoff, 1, FALSE);
-               }
-               break;
-           case BGPTYPE_AS_PATH:
-           case BGPTYPE_NEW_AS_PATH:
-               ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                        "AS path: %s", as_path_emstr->str);
-               as_paths_tree = proto_item_add_subtree(ti, ett_bgp_as_paths);
-
-                /* (o + i + aoff) =
-                   (o + current attribute + aoff bytes to first tuple) */
-                q = o + i + aoff;
-                end = q + tlen;
-
-                /* snarf each AS path tuple, we have to step through each one
-                   again to make a separate subtree so we can't just reuse
-                   as_path_gstr from above */
-               /* XXX - Can we use some g_string*() trickery instead, e.g.
-                  g_string_erase()? */
-                while (q < end) {
-                   ep_strbuf_truncate(as_path_emstr, 0);
-                    type = tvb_get_guint8(tvb, q++);
-                    if (type == AS_SET) {
-                        ep_strbuf_append_c(as_path_emstr, '{');
-                    }
-                    else if (type == AS_CONFED_SET) {
-                        ep_strbuf_append_c(as_path_emstr, '[');
+                case BGPTYPE_ORIGIN:
+                    if (tlen != 1) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Origin (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                    } else {
+                        proto_tree_add_item(subtree2, hf_bgp_origin, tvb,
+                                            o + i + aoff, 1, FALSE);
                     }
-                    else if (type == AS_CONFED_SEQUENCE) {
-                        ep_strbuf_append_c(as_path_emstr, '(');
-                    }
-                    length = tvb_get_guint8(tvb, q++);
-
-                    /* snarf each value in path */
-                    for (j = 0; j < length; j++) {
-                       ep_strbuf_append_printf(as_path_emstr, "%u%s",
-                               (asn_len == 2) ?
-                               tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
-                                (type == AS_SET || type == AS_CONFED_SET) ? ", " : " ");
-                        q += asn_len;
+                    break;
+                case BGPTYPE_AS_PATH:
+                case BGPTYPE_NEW_AS_PATH:
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                             "AS path: %s", as_path_emstr->str);
+                    as_paths_tree = proto_item_add_subtree(ti, ett_bgp_as_paths);
+
+                    /* (o + i + aoff) =
+                       (o + current attribute + aoff bytes to first tuple) */
+                    q = o + i + aoff;
+                    end = q + tlen;
+
+                    /* snarf each AS path tuple, we have to step through each one
+                       again to make a separate subtree so we can't just reuse
+                       as_path_gstr from above */
+                    /* XXX - Can we use some g_string*() trickery instead, e.g.
+                       g_string_erase()? */
+                    while (q < end) {
+                        ep_strbuf_truncate(as_path_emstr, 0);
+                        type = tvb_get_guint8(tvb, q++);
+                        if (type == AS_SET) {
+                            ep_strbuf_append_c(as_path_emstr, '{');
+                        }
+                        else if (type == AS_CONFED_SET) {
+                            ep_strbuf_append_c(as_path_emstr, '[');
+                        }
+                        else if (type == AS_CONFED_SEQUENCE) {
+                            ep_strbuf_append_c(as_path_emstr, '(');
+                        }
+                        length = tvb_get_guint8(tvb, q++);
+
+                        /* snarf each value in path */
+                        for (j = 0; j < length; j++) {
+                            ep_strbuf_append_printf(as_path_emstr, "%u%s",
+                                                    (asn_len == 2) ?
+                                                    tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q),
+                                                    (type == AS_SET || type == AS_CONFED_SET) ? ", " : " ");
+                            q += asn_len;
+                        }
+
+                        /* cleanup end of string */
+                        if (type == AS_SET) {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
+                            ep_strbuf_append_c(as_path_emstr, '}');
+                        }
+                        else if (type == AS_CONFED_SET) {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
+                            ep_strbuf_append_c(as_path_emstr, ']');
+                        }
+                        else if (type == AS_CONFED_SEQUENCE) {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
+                            ep_strbuf_append_c(as_path_emstr, ')');
+                        }
+                        else {
+                            ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
+                        }
+
+                        /* length here means number of ASs, ie length * 2 bytes */
+                        ti = proto_tree_add_text(as_paths_tree, tvb,
+                                                 q - length * asn_len - 2,
+                                                 length * asn_len + 2, "AS path segment: %s", as_path_emstr->str);
+                        as_path_tree = proto_item_add_subtree(ti, ett_bgp_as_paths);
+                        proto_tree_add_text(as_path_tree, tvb, q - length * asn_len - 2,
+                                            1, "Path segment type: %s (%u)",
+                                            val_to_str(type, as_segment_type, "Unknown"), type);
+                        proto_tree_add_text(as_path_tree, tvb, q - length * asn_len - 1,
+                                            1, "Path segment length: %u AS%s", length,
+                                            plurality(length, "", "s"));
+
+                        /* backup and reprint path segment value(s) only */
+                        q -= asn_len * length;
+                        ti = proto_tree_add_text(as_path_tree, tvb, q,
+                                                 length * asn_len, "Path segment value:");
+                        as_path_segment_tree = proto_item_add_subtree(ti,
+                                                                      ett_bgp_as_path_segments);
+                        for (j = 0; j < length; j++) {
+                            as_path_item = (asn_len == 2) ?
+                               tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q);
+                            proto_item_append_text(ti, " %u", as_path_item);
+                            hidden_item = proto_tree_add_uint(as_path_tree, hf_bgp_as_path, tvb,
+                                                              q, asn_len, as_path_item);
+                            PROTO_ITEM_SET_HIDDEN(hidden_item);
+                            q += asn_len;
+                        }
                     }
 
-                    /* cleanup end of string */
-                    if (type == AS_SET) {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
-                       ep_strbuf_append_c(as_path_emstr, '}');
+                    break;
+                case BGPTYPE_NEXT_HOP:
+                    if (tlen != 4) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Next hop (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                    } else {
+                        proto_tree_add_item(subtree2, hf_bgp_next_hop, tvb,
+                                            o + i + aoff, tlen, FALSE);
                     }
-                    else if (type == AS_CONFED_SET) {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 2);
-                       ep_strbuf_append_c(as_path_emstr, ']');
+                    break;
+                case BGPTYPE_MULTI_EXIT_DISC:
+                    if (tlen != 4) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Multiple exit discriminator (invalid): %u byte%s",
+                                            tlen, plurality(tlen, "", "s"));
+                    } else {
+                        proto_tree_add_item(subtree2, hf_bgp_multi_exit_disc, tvb,
+                                            o + i + aoff, tlen, FALSE);
                     }
-                    else if (type == AS_CONFED_SEQUENCE) {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
-                       ep_strbuf_append_c(as_path_emstr, ')');
+                    break;
+                case BGPTYPE_LOCAL_PREF:
+                    if (tlen != 4) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Local preference (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                    } else {
+                        proto_tree_add_item(subtree2, hf_bgp_local_pref, tvb,
+                                            o + i + aoff, tlen, FALSE);
                     }
-                    else {
-                       ep_strbuf_truncate(as_path_emstr, as_path_emstr->len - 1);
+                    break;
+                case BGPTYPE_ATOMIC_AGGREGATE:
+                    if (tlen != 0) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Atomic aggregate (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
                     }
-
-                    /* length here means number of ASs, ie length * 2 bytes */
-                   ti = proto_tree_add_text(as_paths_tree, tvb,
-                            q - length * asn_len - 2,
-                            length * asn_len + 2, "AS path segment: %s", as_path_emstr->str);
-                   as_path_tree = proto_item_add_subtree(ti, ett_bgp_as_paths);
-                   proto_tree_add_text(as_path_tree, tvb, q - length * asn_len - 2,
-                            1, "Path segment type: %s (%u)",
-                            val_to_str(type, as_segment_type, "Unknown"), type);
-                   proto_tree_add_text(as_path_tree, tvb, q - length * asn_len - 1,
-                            1, "Path segment length: %u AS%s", length,
-                            plurality(length, "", "s"));
-
-                    /* backup and reprint path segment value(s) only */
-                    q -= asn_len * length;
-                    ti = proto_tree_add_text(as_path_tree, tvb, q,
-                            length * asn_len, "Path segment value:");
-                    as_path_segment_tree = proto_item_add_subtree(ti,
-                            ett_bgp_as_path_segments);
-                    for (j = 0; j < length; j++) {
-                       as_path_item = (asn_len == 2) ?
-                               tvb_get_ntohs(tvb, q) : tvb_get_ntohl(tvb, q);
-                       proto_item_append_text(ti, " %u", as_path_item);
-                       hidden_item = proto_tree_add_uint(as_path_tree, hf_bgp_as_path, tvb,
-                           q, asn_len, as_path_item);
-                       PROTO_ITEM_SET_HIDDEN(hidden_item);
-                        q += asn_len;
+                    break;
+                case BGPTYPE_AGGREGATOR:
+                    if (tlen != 6 && tlen != 8) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Aggregator (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                        break;
                     }
-                }
-
-               break;
-           case BGPTYPE_NEXT_HOP:
-               if (tlen != 4) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Next hop (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
-               } else {
-                   proto_tree_add_item(subtree2, hf_bgp_next_hop, tvb,
-                           o + i + aoff, tlen, FALSE);
-               }
-               break;
-           case BGPTYPE_MULTI_EXIT_DISC:
-               if (tlen != 4) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Multiple exit discriminator (invalid): %u byte%s",
-                           tlen, plurality(tlen, "", "s"));
-               } else {
-                   proto_tree_add_item(subtree2, hf_bgp_multi_exit_disc, tvb,
-                           o + i + aoff, tlen, FALSE);
-               }
-               break;
-           case BGPTYPE_LOCAL_PREF:
-               if (tlen != 4) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Local preference (invalid): %u byte%s", tlen,
-                             plurality(tlen, "", "s"));
-               } else {
-                   proto_tree_add_item(subtree2, hf_bgp_local_pref, tvb,
-                           o + i + aoff, tlen, FALSE);
-               }
-               break;
-           case BGPTYPE_ATOMIC_AGGREGATE:
-               if (tlen != 0) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Atomic aggregate (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
-                }
-               break;
-           case BGPTYPE_AGGREGATOR:
-               if (tlen != 6 && tlen != 8) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Aggregator (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
-                   break;
-               }
-           case BGPTYPE_NEW_AGGREGATOR:
-                if (bgpa.bgpa_type == BGPTYPE_NEW_AGGREGATOR && tlen != 8)
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Aggregator (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
-               else {
-                   asn_len = tlen - 4;
-                   aggregator_as = (asn_len == 2) ?
+                case BGPTYPE_NEW_AGGREGATOR:
+                    if (bgpa.bgpa_type == BGPTYPE_NEW_AGGREGATOR && tlen != 8)
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Aggregator (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                    else {
+                        asn_len = tlen - 4;
+                        aggregator_as = (asn_len == 2) ?
                            tvb_get_ntohs(tvb, o + i + aoff) :
                            tvb_get_ntohl(tvb, o + i + aoff);
-                   proto_tree_add_uint(subtree2, hf_bgp_aggregator_as, tvb,
-                           o + i + aoff, asn_len, aggregator_as);
-                   proto_tree_add_item(subtree2, hf_bgp_aggregator_origin, tvb,
-                       o + i + aoff + asn_len, 4, FALSE);
-               }
-               break;
-            case BGPTYPE_COMMUNITIES:
-               if (tlen % 4 != 0) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Communities (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
-                    break;
-                }
-
-                ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                        "Communities: %s", communities_emstr->str);
-                communities_tree = proto_item_add_subtree(ti,
-                        ett_bgp_communities);
-
-                /* (o + i + aoff) =
-                   (o + current attribute + aoff bytes to first tuple) */
-                q = o + i + aoff;
-                end = q + tlen;
-
-                /* snarf each community */
-                while (q < end) {
-                    /* check for reserved values */
-                   guint32 community = tvb_get_ntohl(tvb, q);
-                   if ((community & 0xFFFF0000) == FOURHEX0 ||
-                        (community & 0xFFFF0000) == FOURHEXF) {
-                       proto_tree_add_text(communities_tree, tvb,
-                               q - 3 + aoff, 4,
-                               "Community: %s (0x%08x)",
-                               val_to_str(community, community_vals, "(reserved)"),
-                               community);
+                        proto_tree_add_uint(subtree2, hf_bgp_aggregator_as, tvb,
+                                            o + i + aoff, asn_len, aggregator_as);
+                        proto_tree_add_item(subtree2, hf_bgp_aggregator_origin, tvb,
+                                            o + i + aoff + asn_len, 4, FALSE);
                     }
-                    else {
-                        ti = proto_tree_add_text(communities_tree, tvb,
-                                q - 3 + aoff, 4, "Community: %u:%u",
-                                tvb_get_ntohs(tvb, q), tvb_get_ntohs(tvb, q + 2));
-                        community_tree = proto_item_add_subtree(ti,
-                            ett_bgp_communities);
-                        proto_tree_add_item(community_tree, hf_bgp_community_as,
-                            tvb, q - 3 + aoff, 2, FALSE);
-                        proto_tree_add_item(community_tree, hf_bgp_community_value,
-                            tvb, q - 1 + aoff, 2, FALSE);
+                    break;
+                case BGPTYPE_COMMUNITIES:
+                    if (tlen % 4 != 0) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Communities (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                        break;
                     }
 
-                    q += 4;
-                }
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                             "Communities: %s", communities_emstr->str);
+                    communities_tree = proto_item_add_subtree(ti,
+                                                              ett_bgp_communities);
+
+                    /* (o + i + aoff) =
+                       (o + current attribute + aoff bytes to first tuple) */
+                    q = o + i + aoff;
+                    end = q + tlen;
+
+                    /* snarf each community */
+                    while (q < end) {
+                        /* check for reserved values */
+                        guint32 community = tvb_get_ntohl(tvb, q);
+                        if ((community & 0xFFFF0000) == FOURHEX0 ||
+                            (community & 0xFFFF0000) == FOURHEXF) {
+                            proto_tree_add_text(communities_tree, tvb,
+                                                q - 3 + aoff, 4,
+                                                "Community: %s (0x%08x)",
+                                                val_to_str(community, community_vals, "(reserved)"),
+                                                community);
+                        }
+                        else {
+                            ti = proto_tree_add_text(communities_tree, tvb,
+                                                     q - 3 + aoff, 4, "Community: %u:%u",
+                                                     tvb_get_ntohs(tvb, q), tvb_get_ntohs(tvb, q + 2));
+                            community_tree = proto_item_add_subtree(ti,
+                                                                    ett_bgp_communities);
+                            proto_tree_add_item(community_tree, hf_bgp_community_as,
+                                                tvb, q - 3 + aoff, 2, FALSE);
+                            proto_tree_add_item(community_tree, hf_bgp_community_value,
+                                                tvb, q - 1 + aoff, 2, FALSE);
+                        }
 
-               break;
-           case BGPTYPE_ORIGINATOR_ID:
-               if (tlen != 4) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Originator identifier (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
-               } else {
-                   proto_tree_add_item(subtree2, hf_bgp_originator_id, tvb,
-                           o + i + aoff, tlen, FALSE);
-               }
-               break;
-          case BGPTYPE_MP_REACH_NLRI:
-               /*
-                * RFC 2545 specifies that there may be more than one
-                * address in the MP_REACH_NLRI attribute in section
-                * 3, "Constructing the Next Hop field".
-                *
-                * Yes, RFC 2858 says you can't do that, and, yes, RFC
-                * 2858 obsoletes RFC 2283, which says you can do that,
-                * but that doesn't mean we shouldn't dissect packets
-                * that conform to RFC 2283 but not RFC 2858, as some
-                * device on the network might implement the 2283-style
-                * BGP extensions rather than RFC 2858-style extensions.
-                */
-               af = tvb_get_ntohs(tvb, o + i + aoff);
-               proto_tree_add_text(subtree2, tvb, o + i + aoff, 2,
-                   "Address family: %s (%u)",
-                   val_to_str(af, afn_vals, "Unknown"), af);
-                saf = tvb_get_guint8(tvb, o + i + aoff + 2) ;
-               proto_tree_add_text(subtree2, tvb, o + i + aoff + 2, 1,
-                   "Subsequent address family identifier: %s (%u)",
-                   val_to_str(saf, bgpattr_nlri_safi, saf >= 128 ? "Vendor specific" : "Unknown"),
-                   saf);
-               nexthop_len = tvb_get_guint8(tvb, o + i + aoff + 3);
-               ti = proto_tree_add_text(subtree2, tvb, o + i + aoff + 3,
-                       nexthop_len + 1,
-                       "Next hop network address (%d byte%s)",
-                       nexthop_len, plurality(nexthop_len, "", "s"));
-               subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_nhna);
+                        q += 4;
+                    }
 
-                /*
-                 * The addresses don't contain lengths, so if we
-                 * don't understand the address family type, we
-                 * cannot parse the subsequent addresses as we
-                 * don't know how long they are.
-                 */
-                switch (af) {
-                default:
-                   proto_tree_add_text(subtree3, tvb, o + i + aoff + 4,
-                       nexthop_len, "Unknown Address Family");
                     break;
-
-                case AFNUM_INET:
-                case AFNUM_INET6:
-                case AFNUM_L2VPN:
-                case AFNUM_L2VPN_OLD:
-
-                   j = 0;
-                   while (j < nexthop_len) {
-                       advance = mp_addr_to_str(af, saf, tvb, o + i + aoff + 4 + j,
-                                junk_emstr) ;
-                       if (advance == 0) /* catch if this is a unknown AFI type*/
-                                break;
-                       if (j + advance > nexthop_len)
-                               break;
-                       proto_tree_add_text(subtree3, tvb,o + i + aoff + 4 + j,
-                               advance, "Next hop: %s (%u)", junk_emstr->str, advance);
-                       j += advance;
-                   }
+                case BGPTYPE_ORIGINATOR_ID:
+                    if (tlen != 4) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Originator identifier (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                    } else {
+                        proto_tree_add_item(subtree2, hf_bgp_originator_id, tvb,
+                                            o + i + aoff, tlen, FALSE);
+                    }
                     break;
-                }
-
-                aoff_save = aoff;
-                tlen -= nexthop_len + 4;
-                aoff += nexthop_len + 4 ;
+                case BGPTYPE_MP_REACH_NLRI:
+                    /*
+                     * RFC 2545 specifies that there may be more than one
+                     * address in the MP_REACH_NLRI attribute in section
+                     * 3, "Constructing the Next Hop field".
+                     *
+                     * Yes, RFC 2858 says you can't do that, and, yes, RFC
+                     * 2858 obsoletes RFC 2283, which says you can do that,
+                     * but that doesn't mean we shouldn't dissect packets
+                     * that conform to RFC 2283 but not RFC 2858, as some
+                     * device on the network might implement the 2283-style
+                     * BGP extensions rather than RFC 2858-style extensions.
+                     */
+                    af = tvb_get_ntohs(tvb, o + i + aoff);
+                    proto_tree_add_text(subtree2, tvb, o + i + aoff, 2,
+                                        "Address family: %s (%u)",
+                                        val_to_str(af, afn_vals, "Unknown"), af);
+                    saf = tvb_get_guint8(tvb, o + i + aoff + 2) ;
+                    proto_tree_add_text(subtree2, tvb, o + i + aoff + 2, 1,
+                                        "Subsequent address family identifier: %s (%u)",
+                                        val_to_str(saf, bgpattr_nlri_safi, saf >= 128 ? "Vendor specific" : "Unknown"),
+                                        saf);
+                    nexthop_len = tvb_get_guint8(tvb, o + i + aoff + 3);
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff + 3,
+                                             nexthop_len + 1,
+                                             "Next hop network address (%d byte%s)",
+                                             nexthop_len, plurality(nexthop_len, "", "s"));
+                    subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_nhna);
+
+                    /*
+                     * The addresses don't contain lengths, so if we
+                     * don't understand the address family type, we
+                     * cannot parse the subsequent addresses as we
+                     * don't know how long they are.
+                     */
+                    switch (af) {
+                        default:
+                            proto_tree_add_text(subtree3, tvb, o + i + aoff + 4,
+                                                nexthop_len, "Unknown Address Family");
+                            break;
 
-                off = 0;
-               snpa = tvb_get_guint8(tvb, o + i + aoff);
-               ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, 1,
-                       "Subnetwork points of attachment: %u", snpa);
-               off++;
-               if (snpa) {
+                        case AFNUM_INET:
+                        case AFNUM_INET6:
+                        case AFNUM_L2VPN:
+                        case AFNUM_L2VPN_OLD:
+
+                            j = 0;
+                            while (j < nexthop_len) {
+                                advance = mp_addr_to_str(af, saf, tvb, o + i + aoff + 4 + j,
+                                                         junk_emstr) ;
+                                if (advance == 0) /* catch if this is a unknown AFI type*/
+                                    break;
+                                if (j + advance > nexthop_len)
+                                    break;
+                                proto_tree_add_text(subtree3, tvb,o + i + aoff + 4 + j,
+                                                    advance, "Next hop: %s (%u)", junk_emstr->str, advance);
+                                j += advance;
+                            }
+                            break;
+                    } /* switch (af) */
+
+                    aoff_save = aoff;
+                    tlen -= nexthop_len + 4;
+                    aoff += nexthop_len + 4 ;
+
+                    off = 0;
+                    snpa = tvb_get_guint8(tvb, o + i + aoff);
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, 1,
+                                             "Subnetwork points of attachment: %u", snpa);
+                    off++;
+                    if (snpa) {
                        subtree3 = proto_item_add_subtree(ti, ett_bgp_mp_snpa);
                         for (/*nothing*/; snpa > 0; snpa--) {
-                               proto_tree_add_text(subtree3, tvb, o + i + aoff + off, 1,
-                                       "SNPA length: %u", tvb_get_guint8(tvb, o + i + aoff + off));
-                               off++;
-                               proto_tree_add_text(subtree3, tvb, o + i + aoff + off,
-                               tvb_get_guint8(tvb, o + i + aoff + off - 1),
-                                       "SNPA (%u byte%s)", tvb_get_guint8(tvb, o + i + aoff + off - 1),
-                                        plurality(tvb_get_guint8(tvb, o + i + aoff + off - 1), "", "s"));
-                               off += tvb_get_guint8(tvb, o + i + aoff + off - 1);
+                            proto_tree_add_text(subtree3, tvb, o + i + aoff + off, 1,
+                                                "SNPA length: %u", tvb_get_guint8(tvb, o + i + aoff + off));
+                            off++;
+                            proto_tree_add_text(subtree3, tvb, o + i + aoff + off,
+                                                tvb_get_guint8(tvb, o + i + aoff + off - 1),
+                                                "SNPA (%u byte%s)", tvb_get_guint8(tvb, o + i + aoff + off - 1),
+                                                plurality(tvb_get_guint8(tvb, o + i + aoff + off - 1), "", "s"));
+                            off += tvb_get_guint8(tvb, o + i + aoff + off - 1);
                        }
-                }
-                tlen -= off;
-               aoff += off;
-
-               ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                       "Network layer reachability information (%u byte%s)",
-                       tlen, plurality(tlen, "", "s"));
-               if (tlen)  {
-                   subtree3 = proto_item_add_subtree(ti,ett_bgp_mp_reach_nlri);
-                   if (af != AFNUM_INET && af != AFNUM_INET6 && af != AFNUM_L2VPN) {
-                       proto_tree_add_text(subtree3, tvb, o + i + aoff,
-                               tlen, "Unknown Address Family");
-                   } else {
-                       while (tlen > 0) {
+                    }
+                    tlen -= off;
+                    aoff += off;
+
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                             "Network layer reachability information (%u byte%s)",
+                                             tlen, plurality(tlen, "", "s"));
+                    if (tlen)  {
+                        subtree3 = proto_item_add_subtree(ti,ett_bgp_mp_reach_nlri);
+                        if (af != AFNUM_INET && af != AFNUM_INET6 && af != AFNUM_L2VPN) {
+                            proto_tree_add_text(subtree3, tvb, o + i + aoff,
+                                                tlen, "Unknown Address Family");
+                        } else {
+                            while (tlen > 0) {
                                 advance = decode_prefix_MP(subtree3,
-                                    hf_bgp_mp_reach_nlri_ipv4_prefix,
-                                    -1,
-                                    af, saf,
-                                    tvb, o + i + aoff, "MP Reach NLRI");
+                                                           hf_bgp_mp_reach_nlri_ipv4_prefix,
+                                                           -1,
+                                                           af, saf,
+                                                           tvb, o + i + aoff, "MP Reach NLRI");
                                if (advance < 0)
                                    break;
                                tlen -= advance;
                                aoff += advance;
+                            }
                         }
-                   }
-                }
-               aoff = aoff_save;
-               break;
-          case BGPTYPE_MP_UNREACH_NLRI:
-               af = tvb_get_ntohs(tvb, o + i + aoff);
-               proto_tree_add_text(subtree2, tvb, o + i + aoff, 2,
-                   "Address family: %s (%u)",
-                   val_to_str(af, afn_vals, "Unknown"), af);
-                saf = tvb_get_guint8(tvb, o + i + aoff + 2) ;
-               proto_tree_add_text(subtree2, tvb, o + i + aoff + 2, 1,
-                   "Subsequent address family identifier: %s (%u)",
-                   val_to_str(saf, bgpattr_nlri_safi, saf >= 128 ? "Vendor specific" : "Unknown"),
-                   saf);
-               ti = proto_tree_add_text(subtree2, tvb, o + i + aoff + 3,
-                       tlen - 3, "Withdrawn routes (%u byte%s)", tlen - 3,
-                        plurality(tlen - 3, "", "s"));
-
-               aoff_save = aoff;
-               tlen -= 3;
-               aoff += 3;
-               if (tlen > 0) {
-                    subtree3 = proto_item_add_subtree(ti,ett_bgp_mp_unreach_nlri);
-
-                    while (tlen > 0) {
-                        advance = decode_prefix_MP(subtree3,
-                                hf_bgp_mp_unreach_nlri_ipv4_prefix,
-                                -1,
-                                af, saf,
-                                tvb, o + i + aoff, "MP Unreach NLRI");
-                        if (advance < 0)
-                            break;
-                        tlen -= advance;
-                        aoff += advance;
                     }
-                }
-                aoff = aoff_save;
-                break;
-           case BGPTYPE_CLUSTER_LIST:
-               if (tlen % 4 != 0) {
-                   proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                           "Cluster list (invalid): %u byte%s", tlen,
-                            plurality(tlen, "", "s"));
+                    aoff = aoff_save;
                     break;
-                }
+                case BGPTYPE_MP_UNREACH_NLRI:
+                    af = tvb_get_ntohs(tvb, o + i + aoff);
+                    proto_tree_add_text(subtree2, tvb, o + i + aoff, 2,
+                                        "Address family: %s (%u)",
+                                        val_to_str(af, afn_vals, "Unknown"), af);
+                    saf = tvb_get_guint8(tvb, o + i + aoff + 2) ;
+                    proto_tree_add_text(subtree2, tvb, o + i + aoff + 2, 1,
+                                        "Subsequent address family identifier: %s (%u)",
+                                        val_to_str(saf, bgpattr_nlri_safi, saf >= 128 ? "Vendor specific" : "Unknown"),
+                                        saf);
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff + 3,
+                                             tlen - 3, "Withdrawn routes (%u byte%s)", tlen - 3,
+                                             plurality(tlen - 3, "", "s"));
+
+                    aoff_save = aoff;
+                    tlen -= 3;
+                    aoff += 3;
+                    if (tlen > 0) {
+                        subtree3 = proto_item_add_subtree(ti,ett_bgp_mp_unreach_nlri);
+
+                        while (tlen > 0) {
+                            advance = decode_prefix_MP(subtree3,
+                                                       hf_bgp_mp_unreach_nlri_ipv4_prefix,
+                                                       -1,
+                                                       af, saf,
+                                                       tvb, o + i + aoff, "MP Unreach NLRI");
+                            if (advance < 0)
+                                break;
+                            tlen -= advance;
+                            aoff += advance;
+                        }
+                    }
+                    aoff = aoff_save;
+                    break;
+                case BGPTYPE_CLUSTER_LIST:
+                    if (tlen % 4 != 0) {
+                        proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                            "Cluster list (invalid): %u byte%s", tlen,
+                                            plurality(tlen, "", "s"));
+                        break;
+                    }
 
-                ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                        "Cluster list: %s", cluster_list_emstr->str);
-                cluster_list_tree = proto_item_add_subtree(ti,
-                        ett_bgp_cluster_list);
-
-                /* (o + i + aoff) =
-                   (o + current attribute + aoff bytes to first tuple) */
-                q = o + i + aoff;
-                end = q + tlen;
-
-                /* snarf each cluster identifier */
-                while (q < end) {
-                   proto_tree_add_item(cluster_list_tree, hf_bgp_cluster_list,
-                           tvb, q - 3 + aoff, 4, FALSE);
-                    q += 4;
-                }
+                    ti = proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                             "Cluster list: %s", cluster_list_emstr->str);
+                    cluster_list_tree = proto_item_add_subtree(ti,
+                                                               ett_bgp_cluster_list);
+
+                    /* (o + i + aoff) =
+                       (o + current attribute + aoff bytes to first tuple) */
+                    q = o + i + aoff;
+                    end = q + tlen;
+
+                    /* snarf each cluster identifier */
+                    while (q < end) {
+                        proto_tree_add_item(cluster_list_tree, hf_bgp_cluster_list,
+                                            tvb, q - 3 + aoff, 4, FALSE);
+                        q += 4;
+                    }
 
-               break;
-           case BGPTYPE_EXTENDED_COMMUNITY:
-               if (tlen %8 != 0) {
+                    break;
+                case BGPTYPE_EXTENDED_COMMUNITY:
+                    if (tlen %8 != 0) {
                         proto_tree_add_text(subtree3, tvb, o + i + aoff, tlen, "Extended community (invalid) : %u byte%s", tlen,
-                                plurality(tlen, "", "s"));
-                } else {
+                                            plurality(tlen, "", "s"));
+                    } else {
                         q = o + i + aoff ;
                         end = o + i + aoff + tlen ;
                         ti = proto_tree_add_text(subtree2,tvb,q,tlen, "Carried Extended communities");
@@ -2268,77 +2268,77 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
                             is_extended_type = FALSE;
                             /* handle regular types (8 bit) */
                             switch (ext_com8) {
-                           case BGP_EXT_COM_QOS_MARK_T:
-                           case BGP_EXT_COM_QOS_MARK_NT:
-                                is_regular_type = TRUE;
-                               ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
-
-                                subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
-                               ti = proto_tree_add_text(subtree4, tvb, q, 1,
-                                                   "Type: 0x%02x", tvb_get_guint8(tvb,q));
-                               ti = proto_tree_add_text(subtree4, tvb, q+1, 1,
-                                                   "Flags: 0x%02x", tvb_get_guint8(tvb,q+1));
-                               subtree5 = proto_item_add_subtree(ti,ett_bgp_ext_com_flags);
-                               /* add flag bitfield */
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x10, 8, "Remarking", "No Remarking"));
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x08, 8, "Ignored marking", "No Ignored marking"));
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x04, 8, "Aggregation of markings", "No Aggregation of markings"));
-
-                               ti = proto_tree_add_text(subtree4, tvb, q+2, 1,
-                                                   "QoS Set Number: 0x%02x", tvb_get_guint8(tvb,q+2));
-                               ti = proto_tree_add_text(subtree4, tvb, q+3, 1,
-                                                   "Technology Type: 0x%02x (%s)", tvb_get_guint8(tvb,q+3),
-                                                        val_to_str(tvb_get_guint8(tvb,q+3),qos_tech_type,"Unknown"));
-                               ti = proto_tree_add_text(subtree4, tvb, q+4, 2,
-                                                   "QoS Marking O (16 bit): %s", decode_numeric_bitfield(tvb_get_ntohs(tvb,q+4),
-                                                        0xffff, 16, "0x%04x"));
-                               ti = proto_tree_add_text(subtree4, tvb, q+6, 1,
-                                                   "QoS Marking A  (8 bit): %s (decimal %d)", decode_numeric_bitfield(tvb_get_guint8(tvb,q+6),
-                                                        0xff, 8, "0x%02x"), tvb_get_guint8(tvb,q+6));
-                               ti = proto_tree_add_text(subtree4, tvb, q+7, 1,
-                                                   "Defaults to zero: 0x%02x", tvb_get_guint8(tvb,q+7));
-                               break;
-                           case BGP_EXT_COM_COS_CAP_T:
-                                is_regular_type = TRUE;
-                               ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
-
-                               subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
-                               ti = proto_tree_add_text(subtree4, tvb, q, 1,
-                                                   "Type: 0x%02x", tvb_get_guint8(tvb,q));
-                               ti = proto_tree_add_text(subtree4, tvb, q+1, 1,
-                                                   "Flags byte 1 : 0x%02x", tvb_get_guint8(tvb,q+1));
-                               subtree5 = proto_item_add_subtree(ti,ett_bgp_ext_com_flags);
-                               /* add flag bitfield */
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x80, 8, "BE class supported", "BE class NOT supported"));
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x40, 8, "EF class supported", "EF class NOT supported"));
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x20, 8, "AF class supported", "AF class NOT supported"));
-                               ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
-                                                        0x10, 8, "LE class supported", "LE class NOT supported"));
-                               ti = proto_tree_add_text(subtree4, tvb, q+2, 1,
-                                                   "Flags byte 2..7 : 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x",
-                                                       tvb_get_guint8(tvb,q+2),tvb_get_guint8(tvb,q+3),tvb_get_guint8(tvb,q+4),
-                                                       tvb_get_guint8(tvb,q+5),tvb_get_guint8(tvb,q+6),tvb_get_guint8(tvb,q+7));
-                               break;
-                            }
+                                case BGP_EXT_COM_QOS_MARK_T:
+                                case BGP_EXT_COM_QOS_MARK_NT:
+                                    is_regular_type = TRUE;
+                                    ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
+
+                                    subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
+                                    ti = proto_tree_add_text(subtree4, tvb, q, 1,
+                                                             "Type: 0x%02x", tvb_get_guint8(tvb,q));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+1, 1,
+                                                             "Flags: 0x%02x", tvb_get_guint8(tvb,q+1));
+                                    subtree5 = proto_item_add_subtree(ti,ett_bgp_ext_com_flags);
+                                    /* add flag bitfield */
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x10, 8, "Remarking", "No Remarking"));
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x08, 8, "Ignored marking", "No Ignored marking"));
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x04, 8, "Aggregation of markings", "No Aggregation of markings"));
+
+                                    ti = proto_tree_add_text(subtree4, tvb, q+2, 1,
+                                                             "QoS Set Number: 0x%02x", tvb_get_guint8(tvb,q+2));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+3, 1,
+                                                             "Technology Type: 0x%02x (%s)", tvb_get_guint8(tvb,q+3),
+                                                             val_to_str(tvb_get_guint8(tvb,q+3),qos_tech_type,"Unknown"));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+4, 2,
+                                                             "QoS Marking O (16 bit): %s", decode_numeric_bitfield(tvb_get_ntohs(tvb,q+4),
+                                                                                                                   0xffff, 16, "0x%04x"));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+6, 1,
+                                                             "QoS Marking A  (8 bit): %s (decimal %d)", decode_numeric_bitfield(tvb_get_guint8(tvb,q+6),
+                                                                                                                                0xff, 8, "0x%02x"), tvb_get_guint8(tvb,q+6));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+7, 1,
+                                                             "Defaults to zero: 0x%02x", tvb_get_guint8(tvb,q+7));
+                                    break;
+                                case BGP_EXT_COM_COS_CAP_T:
+                                    is_regular_type = TRUE;
+                                    ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
+
+                                    subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
+                                    ti = proto_tree_add_text(subtree4, tvb, q, 1,
+                                                             "Type: 0x%02x", tvb_get_guint8(tvb,q));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+1, 1,
+                                                             "Flags byte 1 : 0x%02x", tvb_get_guint8(tvb,q+1));
+                                    subtree5 = proto_item_add_subtree(ti,ett_bgp_ext_com_flags);
+                                    /* add flag bitfield */
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x80, 8, "BE class supported", "BE class NOT supported"));
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x40, 8, "EF class supported", "EF class NOT supported"));
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x20, 8, "AF class supported", "AF class NOT supported"));
+                                    ti = proto_tree_add_text(subtree5, tvb, q+1, 1, "%s", decode_boolean_bitfield(tvb_get_guint8(tvb,q+1),
+                                                                                                                  0x10, 8, "LE class supported", "LE class NOT supported"));
+                                    ti = proto_tree_add_text(subtree4, tvb, q+2, 1,
+                                                             "Flags byte 2..7 : 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x",
+                                                             tvb_get_guint8(tvb,q+2),tvb_get_guint8(tvb,q+3),tvb_get_guint8(tvb,q+4),
+                                                             tvb_get_guint8(tvb,q+5),tvb_get_guint8(tvb,q+6),tvb_get_guint8(tvb,q+7));
+                                    break;
+                            } /* switch (ext_com8) */
 
                             if (!is_regular_type) {
-                                    ep_strbuf_append(junk_emstr, val_to_str(ext_com,bgpext_com_type,"Unknown"));
+                                ep_strbuf_append(junk_emstr, val_to_str(ext_com,bgpext_com_type,"Unknown"));
 
-                                    /* handle extended length types (16 bit) */
-                                    switch (ext_com) {
+                                /* handle extended length types (16 bit) */
+                                switch (ext_com) {
                                     case BGP_EXT_COM_RT_0:
                                     case BGP_EXT_COM_RT_2:
                                     case BGP_EXT_COM_RO_0:
                                     case BGP_EXT_COM_RO_2:
                                         is_extended_type = TRUE;
                                         ep_strbuf_append_printf(junk_emstr, ": %u%s%d",
-                                                               tvb_get_ntohs(tvb,q+2),":",tvb_get_ntohl(tvb,q+4));
+                                                                tvb_get_ntohs(tvb,q+2),":",tvb_get_ntohl(tvb,q+4));
                                         proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
                                         break ;
                                     case BGP_EXT_COM_RT_1:
@@ -2346,7 +2346,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
                                         is_extended_type = TRUE;
                                         ipaddr = tvb_get_ipv4(tvb,q+2);
                                         ep_strbuf_append_printf(junk_emstr, ": %s%s%u",
-                                                               ip_to_str((guint8 *)&ipaddr),":",tvb_get_ntohs(tvb,q+6));
+                                                                ip_to_str((guint8 *)&ipaddr),":",tvb_get_ntohs(tvb,q+6));
                                         proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
                                         break;
                                     case BGP_EXT_COM_VPN_ORIGIN:
@@ -2360,7 +2360,7 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
                                         is_extended_type = TRUE;
                                         ipaddr = tvb_get_ipv4(tvb,q+2);
                                         ep_strbuf_append_printf(junk_emstr, ": Area: %s, Type: %s", ip_to_str((guint8 *)&ipaddr),
-                                                 val_to_str(tvb_get_guint8(tvb,q+6),bgpext_ospf_rtype,"Unknown"));
+                                                                val_to_str(tvb_get_guint8(tvb,q+6),bgpext_ospf_rtype,"Unknown"));
                                        /* print OSPF Metric type if selected */
                                        /* always print E2 even if not external route -- receiving router should ignore */
                                         if ( (tvb_get_guint8(tvb,q+7)) & BGP_OSPF_RTYPE_METRIC_TYPE ) {
@@ -2381,20 +2381,20 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
                                     case BGP_EXT_COM_L2INFO:
                                         is_extended_type = TRUE;
                                         ep_strbuf_append_printf(junk_emstr,
-                                                               ": %s, Control Flags: %s%s%s%s%s, MTU: %u byte%s",
-                                                               val_to_str(tvb_get_guint8(tvb,q+2),bgp_l2vpn_encaps,"Unknown"),
-                                                               tvb_get_guint8(tvb,q+3) ? "" : "none",
-                                                               tvb_get_ntohs(tvb,q+3)&0x08 ? "Q" : "",
-                                                               tvb_get_ntohs(tvb,q+3)&0x04 ? "F" : "",
-                                                               tvb_get_ntohs(tvb,q+3)&0x02 ? "C" : "",
-                                                               tvb_get_ntohs(tvb,q+3)&0x01 ? "S" : "",
-                                                               tvb_get_ntohs(tvb,q+4),
-                                                               plurality(tvb_get_ntohs(tvb,q+4), "", "s"));
+                                                                ": %s, Control Flags: %s%s%s%s%s, MTU: %u byte%s",
+                                                                val_to_str(tvb_get_guint8(tvb,q+2),bgp_l2vpn_encaps,"Unknown"),
+                                                                tvb_get_guint8(tvb,q+3) ? "" : "none",
+                                                                tvb_get_ntohs(tvb,q+3)&0x08 ? "Q" : "",
+                                                                tvb_get_ntohs(tvb,q+3)&0x04 ? "F" : "",
+                                                                tvb_get_ntohs(tvb,q+3)&0x02 ? "C" : "",
+                                                                tvb_get_ntohs(tvb,q+3)&0x01 ? "S" : "",
+                                                                tvb_get_ntohs(tvb,q+4),
+                                                                plurality(tvb_get_ntohs(tvb,q+4), "", "s"));
                                         ti = proto_tree_add_text(subtree3,tvb,q,8, "%s",junk_emstr->str);
 
                                         subtree4 = proto_item_add_subtree(ti,ett_bgp_extended_communities);
                                         proto_tree_add_text(subtree4,tvb,q+2,1, "Encapsulation: %s",
-                                                                 val_to_str(tvb_get_guint8(tvb,q+2),bgp_l2vpn_encaps,"Unknown"));
+                                                            val_to_str(tvb_get_guint8(tvb,q+2),bgp_l2vpn_encaps,"Unknown"));
                                         proto_tree_add_text(subtree4,tvb,q+3,1, "Control Flags: %s%sControl Word %s required, Sequenced delivery %s required",
                                                             tvb_get_ntohs(tvb,q+3)&0x08 ? "Q flag (Reserved) set" : "",
                                                             tvb_get_ntohs(tvb,q+3)&0x04 ? "F flag (reserved) set" : "",
@@ -2404,93 +2404,93 @@ dissect_bgp_update(tvbuff_t *tvb, proto_tree *tree)
                                                             tvb_get_ntohs(tvb,q+4),
                                                             plurality(tvb_get_ntohs(tvb,q+4), "", "s"));
                                         break;
-                                    }
+                                } /* switch (ext_com) */
                             }
                             if (!is_regular_type && !is_extended_type)
                                 proto_tree_add_text(subtree3,tvb,q,8, "%s","Unknown");
                             q = q + 8;
                         }
-                }
-                break;
-           case BGPTYPE_SAFI_SPECIFIC_ATTR:
-               q = o + i + aoff;
-               end = o + i + aoff + tlen ;
-
-               while(q < end) {
-                   ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
-                   ssa_len = tvb_get_ntohs(tvb, q + 2);
-
-                   ti = proto_tree_add_text(subtree2, tvb, q, MIN(ssa_len + 4, end - q),
-                           "%s Information",
-                           val_to_str(ssa_type, bgp_ssa_type, "Unknown SSA"));
-                   subtree3 = proto_item_add_subtree(ti, ett_bgp_ssa);
-
-                   proto_tree_add_item(subtree3, hf_bgp_ssa_t, tvb,
-                           q, 1, FALSE);
-                   hidden_item = proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb,
-                           q, 2, FALSE);
-                   PROTO_ITEM_SET_HIDDEN(hidden_item);
-                   proto_tree_add_text(subtree3, tvb, q, 2,
-                           "Type: %s", val_to_str(ssa_type, bgp_ssa_type, "Unknown"));
-                   if ((ssa_len == 0) || (q + ssa_len > end)) {
-                       proto_tree_add_text(subtree3, tvb, q + 2, end - q - 2,
-                               "Invalid Length of %u", ssa_len);
-                       break;
-                   }
-                   proto_tree_add_item(subtree3, hf_bgp_ssa_len, tvb,
-                           q + 2, 2, FALSE);
-
-                   switch(ssa_type){
-                   case BGP_SSA_L2TPv3:
-                           proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_pref, tvb,
-                                   q + 4, 2, FALSE);
-
-                           ti = proto_tree_add_text(subtree3, tvb, q + 6, 1, "Flags");
-                           subtree4 = proto_item_add_subtree(ti, ett_bgp_ssa_subtree) ;
-                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_s, tvb,
-                                    q + 6, 1, FALSE);
-                            proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_unused, tvb,
-                                    q + 6, 1, FALSE);
-
-                           ssa_v3_len = tvb_get_guint8(tvb, q + 7);
-                           if (ssa_v3_len + 8 == ssa_len){
-                               proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie_len, tvb,
-                                       q + 7, 1, FALSE);
-                           } else {
-                               proto_tree_add_text(subtree3, tvb, q + 7, 1,
-                                       "Invalid Cookie Length of %u", ssa_v3_len);
-                               q += ssa_len + 4; /* 4 from type and length */
-                               break;
-                           }
-                            proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_session_id, tvb,
-                                    q + 8, 4, FALSE);
-                           if (ssa_v3_len)
+                    }
+                    break;
+                case BGPTYPE_SAFI_SPECIFIC_ATTR:
+                    q = o + i + aoff;
+                    end = o + i + aoff + tlen ;
+
+                    while(q < end) {
+                        ssa_type = tvb_get_ntohs(tvb, q) & BGP_SSA_TYPE;
+                        ssa_len = tvb_get_ntohs(tvb, q + 2);
+
+                        ti = proto_tree_add_text(subtree2, tvb, q, MIN(ssa_len + 4, end - q),
+                                                 "%s Information",
+                                                 val_to_str(ssa_type, bgp_ssa_type, "Unknown SSA"));
+                        subtree3 = proto_item_add_subtree(ti, ett_bgp_ssa);
+
+                        proto_tree_add_item(subtree3, hf_bgp_ssa_t, tvb,
+                                            q, 1, FALSE);
+                        hidden_item = proto_tree_add_item(subtree3, hf_bgp_ssa_type, tvb,
+                                                          q, 2, FALSE);
+                        PROTO_ITEM_SET_HIDDEN(hidden_item);
+                        proto_tree_add_text(subtree3, tvb, q, 2,
+                                            "Type: %s", val_to_str(ssa_type, bgp_ssa_type, "Unknown"));
+                        if ((ssa_len == 0) || (q + ssa_len > end)) {
+                            proto_tree_add_text(subtree3, tvb, q + 2, end - q - 2,
+                                                "Invalid Length of %u", ssa_len);
+                            break;
+                        }
+                        proto_tree_add_item(subtree3, hf_bgp_ssa_len, tvb,
+                                            q + 2, 2, FALSE);
+
+                        switch (ssa_type) {
+                            case BGP_SSA_L2TPv3:
+                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_pref, tvb,
+                                                    q + 4, 2, FALSE);
+
+                                ti = proto_tree_add_text(subtree3, tvb, q + 6, 1, "Flags");
+                                subtree4 = proto_item_add_subtree(ti, ett_bgp_ssa_subtree) ;
+                                proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_s, tvb,
+                                                    q + 6, 1, FALSE);
+                                proto_tree_add_item(subtree4, hf_bgp_ssa_l2tpv3_unused, tvb,
+                                                    q + 6, 1, FALSE);
+
+                                ssa_v3_len = tvb_get_guint8(tvb, q + 7);
+                                if (ssa_v3_len + 8 == ssa_len){
+                                    proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie_len, tvb,
+                                                        q + 7, 1, FALSE);
+                                } else {
+                                    proto_tree_add_text(subtree3, tvb, q + 7, 1,
+                                                        "Invalid Cookie Length of %u", ssa_v3_len);
+                                    q += ssa_len + 4; /* 4 from type and length */
+                                    break;
+                                }
+                                proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_session_id, tvb,
+                                                    q + 8, 4, FALSE);
+                                if (ssa_v3_len)
                                    proto_tree_add_item(subtree3, hf_bgp_ssa_l2tpv3_cookie, tvb,
-                                           q + 12, ssa_v3_len, FALSE);
-                           q += ssa_len + 4; /* 4 from type and length */
-                           break;
-                   case BGP_SSA_mGRE:
-                   case BGP_SSA_IPSec:
-                   case BGP_SSA_MPLS:
-                   default:
-                           proto_tree_add_item(subtree3, hf_bgp_ssa_value, tvb,
-                                   q + 4, ssa_len, FALSE);
-                           q += ssa_len + 4; /* 4 from type and length */
-                           break;
-                   case BGP_SSA_L2TPv3_IN_IPSec:
-                   case BGP_SSA_mGRE_IN_IPSec:
-                           /* These contain BGP_SSA_IPSec and BGP_SSA_L2TPv3/BGP_SSA_mGRE */
-                           q += 4; /* 4 from type and length */
-                           break;
-                   }
-               }
-               break;
-
-           default:
-               proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
-                       "Unknown (%u byte%s)", tlen, plurality(tlen, "", "s"));
-               break;
-           } /* end of second switch */
+                                                        q + 12, ssa_v3_len, FALSE);
+                                q += ssa_len + 4; /* 4 from type and length */
+                                break;
+                            case BGP_SSA_mGRE:
+                            case BGP_SSA_IPSec:
+                            case BGP_SSA_MPLS:
+                            default:
+                                proto_tree_add_item(subtree3, hf_bgp_ssa_value, tvb,
+                                                    q + 4, ssa_len, FALSE);
+                                q += ssa_len + 4; /* 4 from type and length */
+                                break;
+                            case BGP_SSA_L2TPv3_IN_IPSec:
+                            case BGP_SSA_mGRE_IN_IPSec:
+                                /* These contain BGP_SSA_IPSec and BGP_SSA_L2TPv3/BGP_SSA_mGRE */
+                                q += 4; /* 4 from type and length */
+                                break;
+                        } /* switch (bgpa.bgpa_type) */
+                    }
+                    break;
+
+                default:
+                    proto_tree_add_text(subtree2, tvb, o + i + aoff, tlen,
+                                        "Unknown (%u byte%s)", tlen, plurality(tlen, "", "s"));
+                    break;
+           } /* switch (bgpa.bgpa_type) */ /* end of second switch */
 
            i += alen + aoff;
        }
@@ -2569,19 +2569,19 @@ dissect_bgp_route_refresh(tvbuff_t *tvb, proto_tree *tree)
     int             p;         /* tvb offset counter    */
     int                    pend;       /* end of list of entries for one orf type */
     guint16        hlen;       /* tvb RR msg length */
-    proto_item      *ti;       /* tree item             */
-    proto_item      *ti1;       /* tree item             */
-    proto_tree      *subtree;  /* tree for orf   */
-    proto_tree      *subtree1; /* tree for orf entry */
-    guint8          orftype;        /* ORF Type */
-    guint8         orfwhen;        /* ORF flag: immediate, defer */
-    guint16        orflen;         /* ORF len */
-    guint8          entryflag;     /* ORF Entry flag: action(add,del,delall) match(permit,deny) */
-    guint32        entryseq;       /* ORF Entry sequence number */
-    int            entrylen;       /* ORF Entry length */
-    guint8         pfx_ge;         /* ORF PrefixList mask lower bound */
-    guint8          pfx_le;         /* ORF PrefixList mask upper bound */
-    int             advance;        /* tmp                      */
+    proto_item      *ti;       /* tree item             */
+    proto_item      *ti1;      /* tree item             */
+    proto_tree      *subtree;  /* tree for orf   */
+    proto_tree      *subtree1; /* tree for orf entry */
+    guint8          orftype;   /* ORF Type */
+    guint8         orfwhen;    /* ORF flag: immediate, defer */
+    guint16        orflen;     /* ORF len */
+    guint8          entryflag; /* ORF Entry flag: action(add,del,delall) match(permit,deny) */
+    guint32        entryseq;   /* ORF Entry sequence number */
+    int            entrylen;   /* ORF Entry length */
+    guint8         pfx_ge;     /* ORF PrefixList mask lower bound */
+    guint8          pfx_le;    /* ORF PrefixList mask upper bound */
+    int             advance;   /* tmp                      */
 
 
 /*
@@ -2725,9 +2725,9 @@ dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree,
     guint16       bgp_len;       /* Message length             */
     guint8        bgp_type;      /* Message type               */
     const char    *typ;          /* Message type (string)      */
-    proto_item    *ti;           /* tree item                        */
-    proto_tree    *bgp_tree;     /* BGP packet tree                  */
-    proto_tree    *bgp1_tree;    /* BGP message tree                 */
+    proto_item    *ti;           /* tree item                  */
+    proto_tree    *bgp_tree;     /* BGP packet tree            */
+    proto_tree    *bgp1_tree;    /* BGP message tree           */
 
     bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
     bgp_type = tvb_get_guint8(tvb, BGP_MARKER_SIZE + 2);
@@ -2748,28 +2748,28 @@ dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree,
 
        /* add a different tree for each message type */
        switch (bgp_type) {
-       case BGP_OPEN:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp_open);
-           break;
-       case BGP_UPDATE:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp_update);
-           break;
-       case BGP_NOTIFICATION:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp_notification);
-           break;
-       case BGP_KEEPALIVE:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp);
-           break;
-       case BGP_ROUTE_REFRESH_CISCO:
-       case BGP_ROUTE_REFRESH:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh);
-           break;
-       case BGP_CAPABILITY:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp_capability);
-           break;
-       default:
-           bgp1_tree = proto_item_add_subtree(ti, ett_bgp);
-           break;
+            case BGP_OPEN:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp_open);
+                break;
+            case BGP_UPDATE:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp_update);
+                break;
+            case BGP_NOTIFICATION:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp_notification);
+                break;
+            case BGP_KEEPALIVE:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp);
+                break;
+            case BGP_ROUTE_REFRESH_CISCO:
+            case BGP_ROUTE_REFRESH:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp_route_refresh);
+                break;
+            case BGP_CAPABILITY:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp_capability);
+                break;
+            default:
+                bgp1_tree = proto_item_add_subtree(ti, ett_bgp);
+                break;
        }
 
        proto_tree_add_text(bgp1_tree, tvb, 0, BGP_MARKER_SIZE,
@@ -2791,27 +2791,27 @@ dissect_bgp_pdu(tvbuff_t *volatile tvb, packet_info *pinfo, proto_tree *tree,
                                   bgp_type);
 
        switch (bgp_type) {
-       case BGP_OPEN:
-           dissect_bgp_open(tvb, bgp1_tree);
-           break;
-       case BGP_UPDATE:
-           dissect_bgp_update(tvb, bgp1_tree);
-           break;
-       case BGP_NOTIFICATION:
-           dissect_bgp_notification(tvb, bgp1_tree);
-           break;
-       case BGP_KEEPALIVE:
-           /* no data in KEEPALIVE messages */
-           break;
-        case BGP_ROUTE_REFRESH_CISCO:
-       case BGP_ROUTE_REFRESH:
-           dissect_bgp_route_refresh(tvb, bgp1_tree);
-           break;
-       case BGP_CAPABILITY:
-           dissect_bgp_capability(tvb, bgp1_tree);
-           break;
-       default:
-           break;
+            case BGP_OPEN:
+                dissect_bgp_open(tvb, bgp1_tree);
+                break;
+            case BGP_UPDATE:
+                dissect_bgp_update(tvb, bgp1_tree);
+                break;
+            case BGP_NOTIFICATION:
+                dissect_bgp_notification(tvb, bgp1_tree);
+                break;
+            case BGP_KEEPALIVE:
+                /* no data in KEEPALIVE messages */
+                break;
+            case BGP_ROUTE_REFRESH_CISCO:
+            case BGP_ROUTE_REFRESH:
+                dissect_bgp_route_refresh(tvb, bgp1_tree);
+                break;
+            case BGP_CAPABILITY:
+                dissect_bgp_capability(tvb, bgp1_tree);
+                break;
+            default:
+                break;
        }
     }
 }
index f1377214bbf9f1a27b228cead677f1428d66b643..48d4dafb996dd24a3b56aee806283126cdf69a90 100644 (file)
@@ -92,35 +92,35 @@ static const value_string bittorrent_messages[] = {
 };
 
 static const value_string azureus_priorities[] = {
-  { 0, "Low" },
-  { 1, "Normal" },
-  { 2, "High" },
-  { 0, NULL }
+   { 0, "Low" },
+   { 1, "Normal" },
+   { 2, "High" },
+   { 0, NULL }
 };
 
 
 struct amp_message {
-  const char *name;
-  guint32 value;
+   const char *name;
+   guint32 value;
 };
 
 static const struct amp_message amp_messages[] = {
-  { "BT_KEEP_ALIVE", AZUREUS_MESSAGE_KEEP_ALIVE },
-  { "BT_CHOKE", BITTORRENT_MESSAGE_CHOKE },
-  { "BT_UNCHOKE", BITTORRENT_MESSAGE_UNCHOKE },
-  { "BT_INTERESTED", BITTORRENT_MESSAGE_INTERESTED },
-  { "BT_UNINTERESTED", BITTORRENT_MESSAGE_NOT_INTERESTED },
-  { "BT_HAVE", BITTORRENT_MESSAGE_HAVE },
-  { "BT_BITFIELD", BITTORRENT_MESSAGE_BITFIELD },
-  { "BT_REQUEST", BITTORRENT_MESSAGE_REQUEST },
-  { "BT_PIECE", BITTORRENT_MESSAGE_PIECE },
-  { "BT_CANCEL", BITTORRENT_MESSAGE_CANCEL },
-  { "AZ_HANDSHAKE", AZUREUS_MESSAGE_HANDSHAKE },
-  { "BT_HANDSHAKE", AZUREUS_MESSAGE_BT_HANDSHAKE },
-  { "AZ_PEER_EXCHANGE", AZUREUS_MESSAGE_PEER_EXCHANGE },
-  { "JPC_HELLO", AZUREUS_MESSAGE_JPC_HELLO },
-  { "JPC_REPLY", AZUREUS_MESSAGE_JPC_REPLY },
-  { NULL, 0 }
+   { "BT_KEEP_ALIVE", AZUREUS_MESSAGE_KEEP_ALIVE },
+   { "BT_CHOKE", BITTORRENT_MESSAGE_CHOKE },
+   { "BT_UNCHOKE", BITTORRENT_MESSAGE_UNCHOKE },
+   { "BT_INTERESTED", BITTORRENT_MESSAGE_INTERESTED },
+   { "BT_UNINTERESTED", BITTORRENT_MESSAGE_NOT_INTERESTED },
+   { "BT_HAVE", BITTORRENT_MESSAGE_HAVE },
+   { "BT_BITFIELD", BITTORRENT_MESSAGE_BITFIELD },
+   { "BT_REQUEST", BITTORRENT_MESSAGE_REQUEST },
+   { "BT_PIECE", BITTORRENT_MESSAGE_PIECE },
+   { "BT_CANCEL", BITTORRENT_MESSAGE_CANCEL },
+   { "AZ_HANDSHAKE", AZUREUS_MESSAGE_HANDSHAKE },
+   { "BT_HANDSHAKE", AZUREUS_MESSAGE_BT_HANDSHAKE },
+   { "AZ_PEER_EXCHANGE", AZUREUS_MESSAGE_PEER_EXCHANGE },
+   { "JPC_HELLO", AZUREUS_MESSAGE_JPC_HELLO },
+   { "JPC_REPLY", AZUREUS_MESSAGE_JPC_REPLY },
+   { NULL, 0 }
 };
 
 static dissector_handle_t dissector_handle;
@@ -306,260 +306,260 @@ static guint get_bittorrent_pdu_length(packet_info *pinfo _U_, tvbuff_t *tvb, in
 }
 
 static int dissect_bencoding_str(tvbuff_t *tvb, packet_info *pinfo _U_,
-                                int offset, int length, proto_tree *tree, proto_item *ti, int treeadd)
+                                 int offset, int length, proto_tree *tree, proto_item *ti, int treeadd)
 {
-  guint8 ch;
-  int stringlen = 0, nextstringlen;
-  int used;
-  int izero = 0;
-
-  if (length<2) {
-    if (tree) {
-      proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid String");
-    }
-    return -1;
-  }
-
-  used = 0;
-
-  while (length>=1) {
-    ch = tvb_get_guint8(tvb, offset+used);
-    length--;
-    used++;
-
-    if (ch==':' && used>1) {
-      if (stringlen>length || stringlen<0) {
-       if (tree) {
-         proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid String Length");
-       }
-       return -1;
-      }
+   guint8 ch;
+   int stringlen = 0, nextstringlen;
+   int used;
+   int izero = 0;
+
+   if (length<2) {
       if (tree) {
-       proto_tree_add_uint(tree, hf_bittorrent_bstr_length, tvb, offset, used, stringlen);
-       proto_tree_add_item(tree, hf_bittorrent_bstr, tvb, offset+used, stringlen, FALSE);
-
-       if (treeadd==1) {
-         proto_item_append_text(ti, " Key: %s", format_text(ep_tvb_memdup(tvb, offset+used, stringlen), stringlen));
-       }
-       if (treeadd==2) {
-         proto_item_append_text(ti, "  Value: %s", format_text(ep_tvb_memdup(tvb, offset+used, stringlen), stringlen));
-       }
+         proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid String");
+      }
+      return -1;
+   }
+
+   used = 0;
+
+   while (length>=1) {
+      ch = tvb_get_guint8(tvb, offset+used);
+      length--;
+      used++;
+
+      if (ch==':' && used>1) {
+         if (stringlen>length || stringlen<0) {
+            if (tree) {
+               proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid String Length");
+            }
+            return -1;
+         }
+         if (tree) {
+            proto_tree_add_uint(tree, hf_bittorrent_bstr_length, tvb, offset, used, stringlen);
+            proto_tree_add_item(tree, hf_bittorrent_bstr, tvb, offset+used, stringlen, FALSE);
+
+            if (treeadd==1) {
+               proto_item_append_text(ti, " Key: %s", format_text(ep_tvb_memdup(tvb, offset+used, stringlen), stringlen));
+            }
+            if (treeadd==2) {
+               proto_item_append_text(ti, "  Value: %s", format_text(ep_tvb_memdup(tvb, offset+used, stringlen), stringlen));
+            }
+         }
+         return used+stringlen;
       }
-      return used+stringlen;
-    }
 
-    if (!izero && ch>='0' && ch<='9') {
-      if (ch=='0' && used==1) {
-       izero = 1;
+      if (!izero && ch>='0' && ch<='9') {
+         if (ch=='0' && used==1) {
+            izero = 1;
+         }
+
+         nextstringlen = (stringlen * 10) + (ch - '0');
+         if (nextstringlen>=stringlen) {
+            stringlen = nextstringlen;
+            continue;
+         }
       }
 
-      nextstringlen = (stringlen * 10) + (ch - '0');
-      if (nextstringlen>=stringlen) {
-       stringlen = nextstringlen;
-       continue;
+      if (tree) {
+         proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid String");
       }
-    }
-
-    if (tree) {
-      proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid String");
-    }
-    return -1;
-  }
-
-  if (tree) {
-    proto_tree_add_text(tree, tvb, offset, length, "Truncated Data");
-  }
-  return -1;
+      return -1;
+   }
+
+   if (tree) {
+      proto_tree_add_text(tree, tvb, offset, length, "Truncated Data");
+   }
+   return -1;
 }
 
 static int dissect_bencoding_int(tvbuff_t *tvb, packet_info *pinfo _U_,
-                                int offset, int length, proto_tree *tree, proto_item *ti, int treeadd)
+                                 int offset, int length, proto_tree *tree, proto_item *ti, int treeadd)
 {
-  gint32 ival=0;
-  int neg = 0;
-  int izero = 0;
-  int used;
-  guint8 ch;
-
-  if (length<3) {
-    if (tree) {
-      proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid Integer");
-    }
-    return -1;
-  }
-
-  length--;
-  used = 1;
-
-  while (length>=1) {
-    ch = tvb_get_guint8(tvb, offset+used);
-    length--;
-    used++;
-
-    switch (ch) {
-    case 'e':
+   gint32 ival=0;
+   int neg = 0;
+   int izero = 0;
+   int used;
+   guint8 ch;
+
+   if (length<3) {
       if (tree) {
-       if (neg) ival = -ival;
-       proto_tree_add_int(tree, hf_bittorrent_bint, tvb, offset, used, ival);
-       if (treeadd==2) {
-         proto_item_append_text(ti, "  Value: %d", ival);
-       }
+         proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid Integer");
       }
-      return used;
+      return -1;
+   }
 
-    case '-':
-      if (used==2) {
-       neg = 1;
-       break;
-      }
-      /* Fall through */
-
-    default:
-      if (!(ch=='0' && used==3 && neg)) { /* -0 is invalid */
-       if (ch=='0' && used==2) { /* as is 0[0-9]+ */
-         izero = 1;
-         break;
-       }
-       if (!izero && ch>='0' && ch<='9') {
-         ival = (ival * 10) + (ch - '0');
-         break;
-       }
-      }
+   length--;
+   used = 1;
+
+   while (length>=1) {
+      ch = tvb_get_guint8(tvb, offset+used);
+      length--;
+      used++;
+
+      switch (ch) {
+      case 'e':
+         if (tree) {
+            if (neg) ival = -ival;
+            proto_tree_add_int(tree, hf_bittorrent_bint, tvb, offset, used, ival);
+            if (treeadd==2) {
+               proto_item_append_text(ti, "  Value: %d", ival);
+            }
+         }
+         return used;
 
-      if (tree) {
-       proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid Integer");
+      case '-':
+         if (used==2) {
+            neg = 1;
+            break;
+         }
+         /* Fall through */
+
+      default:
+         if (!(ch=='0' && used==3 && neg)) { /* -0 is invalid */
+            if (ch=='0' && used==2) { /* as is 0[0-9]+ */
+               izero = 1;
+               break;
+            }
+            if (!izero && ch>='0' && ch<='9') {
+               ival = (ival * 10) + (ch - '0');
+               break;
+            }
+         }
+
+         if (tree) {
+            proto_tree_add_text(tree, tvb, offset, length, "Decode Aborted: Invalid Integer");
+         }
+         return -1;
       }
-      return -1;
-    }
-  }
+   }
 
-  if (tree) {
-    proto_tree_add_text(tree, tvb, offset, length, "Truncated Data");
-  }
-  return -1;
+   if (tree) {
+      proto_tree_add_text(tree, tvb, offset, length, "Truncated Data");
+   }
+   return -1;
 }
 
 static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo _U_,
-                                int offset, int length, proto_tree *tree, int level, proto_item *treei, int treeadd)
+                                 int offset, int length, proto_tree *tree, int level, proto_item *treei, int treeadd)
 {
-  guint8 op;
-  int oplen = 0, op1len, op2len;
-  int used;
-
-  proto_item *ti = NULL, *td = NULL;
-  proto_tree *itree = NULL, *dtree = NULL;
-
-  if (level>10) {
-    proto_tree_add_text(tree, tvb, offset, -1, "Decode Aborted: Nested Too Deep");
-    return -1;
-  }
-  if (length<1) {
-    proto_tree_add_text(tree, tvb, offset, -1, "Truncated Data");
-    return length;
-  }
-
-  op = tvb_get_guint8(tvb, offset);
-  if (tree) {
-    oplen = dissect_bencoding_rec(tvb, pinfo, offset, length, NULL, level, NULL, 0);
-    if (oplen<0) oplen = length;
-  }
-
-  switch (op) {
-  case 'd':
-    if (tree) {
-      td = proto_tree_add_item(tree, hf_bittorrent_bdict, tvb, offset, oplen, FALSE);
-      dtree = proto_item_add_subtree(td, ett_bittorrent_bdict);
-    }
-
-    used = 1;
-    length--;
-
-    while (length>=1) {
-      op = tvb_get_guint8(tvb, offset+used);
-
-      if (op=='e') {
-       return used+1;
-      }
+   guint8 op;
+   int oplen = 0, op1len, op2len;
+   int used;
 
-      op1len = dissect_bencoding_str(tvb, pinfo, offset+used, length, NULL, NULL, 0);
-      if (op1len<0) {
-       if (dtree) {
-         proto_tree_add_text(dtree, tvb, offset+used, -1, "Decode Aborted: Invalid Dictionary Key");
-       }
-       return op1len;
-      }
+   proto_item *ti = NULL, *td = NULL;
+   proto_tree *itree = NULL, *dtree = NULL;
 
-      op2len = -1;
-      if (length-op1len>2)
-       op2len = dissect_bencoding_rec(tvb, pinfo, offset+used+op1len, length-op1len, NULL, level+1, NULL, 0);
-      if (op2len<0) {
-       if (dtree) {
-         proto_tree_add_text(dtree, tvb, offset+used+op1len, -1, "Decode Aborted: Invalid Dictionary Value");
-       }
-       return op2len;
-      }
+   if (level>10) {
+      proto_tree_add_text(tree, tvb, offset, -1, "Decode Aborted: Nested Too Deep");
+      return -1;
+   }
+   if (length<1) {
+      proto_tree_add_text(tree, tvb, offset, -1, "Truncated Data");
+      return length;
+   }
 
-      if (dtree) {
-       ti = proto_tree_add_item(dtree, hf_bittorrent_bdict_entry, tvb, offset+used, op1len+op2len, FALSE);
-       itree = proto_item_add_subtree(ti, ett_bittorrent_bdict_entry);
+   op = tvb_get_guint8(tvb, offset);
+   if (tree) {
+      oplen = dissect_bencoding_rec(tvb, pinfo, offset, length, NULL, level, NULL, 0);
+      if (oplen<0) oplen = length;
+   }
 
-       dissect_bencoding_str(tvb, pinfo, offset+used, length, itree, ti, 1);
-       dissect_bencoding_rec(tvb, pinfo, offset+used+op1len, length-op1len, itree, level+1, ti, 2);
+   switch (op) {
+   case 'd':
+      if (tree) {
+         td = proto_tree_add_item(tree, hf_bittorrent_bdict, tvb, offset, oplen, FALSE);
+         dtree = proto_item_add_subtree(td, ett_bittorrent_bdict);
       }
 
-      used += op1len+op2len;
-      length -= op1len+op2len;
-    }
-    if (dtree) {
-      proto_tree_add_text(dtree, tvb, offset+used, -1, "Truncated Data");
-    }
-    return -1;
+      used = 1;
+      length--;
+
+      while (length>=1) {
+         op = tvb_get_guint8(tvb, offset+used);
+
+         if (op=='e') {
+            return used+1;
+         }
 
-  case 'l':
-    if (tree) {
-      ti = proto_tree_add_item(tree, hf_bittorrent_blist, tvb, offset, oplen, FALSE);
-      itree = proto_item_add_subtree(ti, ett_bittorrent_blist);
-    }
+         op1len = dissect_bencoding_str(tvb, pinfo, offset+used, length, NULL, NULL, 0);
+         if (op1len<0) {
+            if (dtree) {
+               proto_tree_add_text(dtree, tvb, offset+used, -1, "Decode Aborted: Invalid Dictionary Key");
+            }
+            return op1len;
+         }
 
-    used = 1;
-    length--;
+         op2len = -1;
+         if (length-op1len>2)
+            op2len = dissect_bencoding_rec(tvb, pinfo, offset+used+op1len, length-op1len, NULL, level+1, NULL, 0);
+         if (op2len<0) {
+            if (dtree) {
+               proto_tree_add_text(dtree, tvb, offset+used+op1len, -1, "Decode Aborted: Invalid Dictionary Value");
+            }
+            return op2len;
+         }
 
-    while (length>=1) {
-      op = tvb_get_guint8(tvb, offset+used);
+         if (dtree) {
+            ti = proto_tree_add_item(dtree, hf_bittorrent_bdict_entry, tvb, offset+used, op1len+op2len, FALSE);
+            itree = proto_item_add_subtree(ti, ett_bittorrent_bdict_entry);
+
+            dissect_bencoding_str(tvb, pinfo, offset+used, length, itree, ti, 1);
+            dissect_bencoding_rec(tvb, pinfo, offset+used+op1len, length-op1len, itree, level+1, ti, 2);
+         }
+
+         used += op1len+op2len;
+         length -= op1len+op2len;
+      }
+      if (dtree) {
+         proto_tree_add_text(dtree, tvb, offset+used, -1, "Truncated Data");
+      }
+      return -1;
 
-      if (op=='e') {
-       return used+1;
+   case 'l':
+      if (tree) {
+         ti = proto_tree_add_item(tree, hf_bittorrent_blist, tvb, offset, oplen, FALSE);
+         itree = proto_item_add_subtree(ti, ett_bittorrent_blist);
       }
 
-      oplen = dissect_bencoding_rec(tvb, pinfo, offset+used, length, itree, level+1, ti, 0);
-      if (oplen<1) return oplen;
+      used = 1;
+      length--;
 
-      used += oplen;
-      length -= oplen;
-    }
-    if (itree) {
-      proto_tree_add_text(itree, tvb, offset+used, -1, "Truncated Data");
-    }
-    return -1;
+      while (length>=1) {
+         op = tvb_get_guint8(tvb, offset+used);
 
-  case 'i':
-    return dissect_bencoding_int(tvb, pinfo, offset, length, tree, treei, treeadd);
+         if (op=='e') {
+            return used+1;
+         }
 
-  default:
-    if (op>='1' && op<='9') {
-      return dissect_bencoding_str(tvb, pinfo, offset, length, tree, treei, treeadd);
-    }
+         oplen = dissect_bencoding_rec(tvb, pinfo, offset+used, length, itree, level+1, ti, 0);
+         if (oplen<1) return oplen;
 
-    if (tree) {
-      proto_tree_add_text(tree, tvb, offset, -1, "Decode Aborted: Invalid Bencoding");
-    }
-  }
+         used += oplen;
+         length -= oplen;
+      }
+      if (itree) {
+         proto_tree_add_text(itree, tvb, offset+used, -1, "Truncated Data");
+      }
+      return -1;
+
+   case 'i':
+      return dissect_bencoding_int(tvb, pinfo, offset, length, tree, treei, treeadd);
+
+   default:
+      if (op>='1' && op<='9') {
+         return dissect_bencoding_str(tvb, pinfo, offset, length, tree, treei, treeadd);
+      }
 
-  return -1;
+      if (tree) {
+         proto_tree_add_text(tree, tvb, offset, -1, "Decode Aborted: Invalid Bencoding");
+      }
+   }
+
+   return -1;
 }
 
 static void dissect_bencoding(tvbuff_t *tvb, packet_info *pinfo _U_,
-                            int offset, int length, proto_tree *tree)
+                              int offset, int length, proto_tree *tree)
 {
   dissect_bencoding_rec(tvb, pinfo, offset, length, tree, 0, NULL, 0);
 }
@@ -586,53 +586,55 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto
       type = tvb_get_guint8(tvb, offset + BITTORRENT_HEADER_LENGTH);
 
       if (type==BITTORRENT_MESSAGE_CHOKE && length>4) {
-       /*
-        * Choke messages have no payload, so this is likely an Azureus
-        * Messaging Protocol packet
-        */
-       if (!tvb_bytes_exist(tvb, offset + BITTORRENT_HEADER_LENGTH, 4))
-         return;
-
-       typelen = tvb_get_ntohl(tvb, offset + BITTORRENT_HEADER_LENGTH);
-       if (4+typelen+1<=length) {
-         if (!tvb_bytes_exist(tvb, offset + BITTORRENT_HEADER_LENGTH + 4, typelen+1))
-           return;
-
-         for ( i=0 ; amp_messages[i].name ; i++ ) {
-           if (strlen(amp_messages[i].name)==typelen &&
-               tvb_memeql(tvb, offset + BITTORRENT_HEADER_LENGTH + 4,
-                          amp_messages[i].name, (int)strlen(amp_messages[i].name))==0) {
-
-             prio = tvb_get_guint8(tvb, offset + BITTORRENT_HEADER_LENGTH + 4 + typelen);
-             if (prio==0 || prio==1 || prio==2) {
-               type = amp_messages[i].value;
-               doffset = BITTORRENT_HEADER_LENGTH + 4 + typelen + 1;
-               isamp = 1;
-             }
-             break;
-           }
-         }
-       }
+         /*
+          * Choke messages have no payload, so this is likely an Azureus
+          * Messaging Protocol packet
+          */
+         if (!tvb_bytes_exist(tvb, offset + BITTORRENT_HEADER_LENGTH, 4))
+            return;
+
+         typelen = tvb_get_ntohl(tvb, offset + BITTORRENT_HEADER_LENGTH);
+         if (4+typelen+1<=length) {
+            if (!tvb_bytes_exist(tvb, offset + BITTORRENT_HEADER_LENGTH + 4, typelen+1))
+               return;
+
+            for ( i=0 ; amp_messages[i].name ; i++ ) {
+               if (strlen(amp_messages[i].name)==typelen &&
+                   tvb_memeql(tvb, offset + BITTORRENT_HEADER_LENGTH + 4,
+                              amp_messages[i].name, (int)strlen(amp_messages[i].name))==0) {
+
+                  prio = tvb_get_guint8(tvb, offset + BITTORRENT_HEADER_LENGTH + 4 + typelen);
+                  if (prio==0 || prio==1 || prio==2) {
+                     type = amp_messages[i].value;
+                     doffset = BITTORRENT_HEADER_LENGTH + 4 + typelen + 1;
+                     isamp = 1;
+                  }
+                  break;
+               }
+            }
+         }
       }
 
       msgtype = match_strval(type, bittorrent_messages);
-      /*      if (msgtype == NULL && isamp) {
-       msgtype = match_strval(type, azureus_messages);
-       } */
+#if 0
+      if (msgtype == NULL && isamp) {
+         msgtype = match_strval(type, azureus_messages);
+      }
+#endif
       if (msgtype == NULL) {
          proto_tree_add_text(tree, tvb, offset, -1, "Continuation data");
          col_set_str(pinfo->cinfo, COL_INFO, "Continuation data");
          return;
       }
    } else {
-         /* not enough bytes of the header, stop here */
-         return;
+      /* not enough bytes of the header, stop here */
+      return;
    }
 
    if (isamp) {
-     ti = proto_tree_add_item(tree, hf_azureus_msg, tvb, offset, length + BITTORRENT_HEADER_LENGTH, FALSE);
+      ti = proto_tree_add_item(tree, hf_azureus_msg, tvb, offset, length + BITTORRENT_HEADER_LENGTH, FALSE);
    } else {
-     ti = proto_tree_add_item(tree, hf_bittorrent_msg, tvb, offset, length + BITTORRENT_HEADER_LENGTH, FALSE);
+      ti = proto_tree_add_item(tree, hf_bittorrent_msg, tvb, offset, length + BITTORRENT_HEADER_LENGTH, FALSE);
    }
    mtree = proto_item_add_subtree(ti, ett_bittorrent_msg);
 
@@ -649,17 +651,17 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto
    /* If the tvb_bytes_exist() call above returned FALSE, this will
       throw an exception, so we won't use msgtype or type. */
    if (isamp) {
-     proto_tree_add_item(mtree, hf_azureus_msg_type_len, tvb, offset, 4, FALSE);
-     proto_tree_add_item(mtree, hf_azureus_msg_type, tvb, offset+4, typelen, FALSE);
-     proto_item_append_text(ti, ": Len %u, %s", length, msgtype);
-     proto_tree_add_item(mtree, hf_azureus_msg_prio, tvb, offset+4+typelen, 1, FALSE);
-     offset += 4+typelen+1;
-     length -= 4+typelen+1;
+      proto_tree_add_item(mtree, hf_azureus_msg_type_len, tvb, offset, 4, FALSE);
+      proto_tree_add_item(mtree, hf_azureus_msg_type, tvb, offset+4, typelen, FALSE);
+      proto_item_append_text(ti, ": Len %u, %s", length, msgtype);
+      proto_tree_add_item(mtree, hf_azureus_msg_prio, tvb, offset+4+typelen, 1, FALSE);
+      offset += 4+typelen+1;
+      length -= 4+typelen+1;
    } else {
-     proto_tree_add_item(mtree, hf_bittorrent_msg_type, tvb, offset, 1, FALSE);
-     proto_item_append_text(ti, ": Len:%u, %s", length, msgtype);
-     offset += 1;
-     length -= 1;
+      proto_tree_add_item(mtree, hf_bittorrent_msg_type, tvb, offset, 1, FALSE);
+      proto_item_append_text(ti, ": Len:%u, %s", length, msgtype);
+      offset += 1;
+      length -= 1;
    }
    col_set_str(pinfo->cinfo, COL_INFO, msgtype);
 
@@ -673,25 +675,25 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto
 
    case BITTORRENT_MESSAGE_REQUEST:
    case BITTORRENT_MESSAGE_CANCEL:
-         piece_index = tvb_get_ntohl(tvb, offset);
+      piece_index = tvb_get_ntohl(tvb, offset);
       proto_tree_add_uint(mtree, hf_bittorrent_piece_index, tvb, offset, 4, piece_index); offset += 4;
-         piece_begin = tvb_get_ntohl(tvb, offset);
+      piece_begin = tvb_get_ntohl(tvb, offset);
       proto_tree_add_uint(mtree, hf_bittorrent_piece_begin, tvb, offset, 4, piece_begin); offset += 4;
-         piece_length = tvb_get_ntohl(tvb, offset);
+      piece_length = tvb_get_ntohl(tvb, offset);
       proto_tree_add_uint(mtree, hf_bittorrent_piece_length, tvb, offset, 4, piece_length);
       proto_item_append_text(ti, ", Piece (Idx:0x%x,Begin:0x%x,Len:0x%x)", piece_index, piece_begin, piece_length);
       if (check_col(pinfo->cinfo, COL_INFO)) {
          col_append_fstr(pinfo->cinfo, COL_INFO, ", Piece (Idx:0x%x,Begin:0x%x,Len:0x%x)", piece_index, piece_begin, piece_length);
-         }
+      }
       break;
 
    case BITTORRENT_MESSAGE_HAVE:
-         piece_index = tvb_get_ntohl(tvb, offset);
+      piece_index = tvb_get_ntohl(tvb, offset);
       proto_tree_add_item(mtree, hf_bittorrent_piece_index, tvb, offset, 4, FALSE);
       proto_item_append_text(ti, ", Piece (Idx:0x%x)", piece_index);
       if (check_col(pinfo->cinfo, COL_INFO)) {
          col_append_fstr(pinfo->cinfo, COL_INFO, ", Piece (Idx:0x%x)", piece_index);
-         }
+      }
       break;
 
    case BITTORRENT_MESSAGE_BITFIELD:
@@ -699,15 +701,15 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto
       proto_item_append_text(ti, ", Len:0x%x", length);
       if (check_col(pinfo->cinfo, COL_INFO)) {
          col_append_fstr(pinfo->cinfo, COL_INFO, ", Len:0x%x", length);
-         }
+      }
       break;
 
    case BITTORRENT_MESSAGE_PIECE:
-         piece_index = tvb_get_ntohl(tvb, offset);
+      piece_index = tvb_get_ntohl(tvb, offset);
       proto_tree_add_uint(mtree, hf_bittorrent_piece_index, tvb, offset, 4, piece_index);
       offset += 4;
       length -= 4;
-         piece_begin = tvb_get_ntohl(tvb, offset);
+      piece_begin = tvb_get_ntohl(tvb, offset);
       proto_tree_add_item(mtree, hf_bittorrent_piece_begin, tvb, offset, 4, piece_begin);
       offset += 4;
       length -= 4;
@@ -715,25 +717,25 @@ static void dissect_bittorrent_message (tvbuff_t *tvb, packet_info *pinfo, proto
       proto_item_append_text(ti, ", Idx:0x%x,Begin:0x%x,Len:0x%x", piece_index, piece_begin, length);
       if (check_col(pinfo->cinfo, COL_INFO)) {
          col_append_fstr(pinfo->cinfo, COL_INFO, ", Idx:0x%x,Begin:0x%x,Len:0x%x", piece_index, piece_begin, length);
-         }
+      }
       break;
 
    case AZUREUS_MESSAGE_HANDSHAKE:
    case AZUREUS_MESSAGE_PEER_EXCHANGE:
-     dissect_bencoding(tvb, pinfo, offset, length, mtree);
-     break;
+      dissect_bencoding(tvb, pinfo, offset, length, mtree);
+      break;
 
    case AZUREUS_MESSAGE_JPC_HELLO:
-     stringlen = tvb_get_ntohl(tvb, offset);
-     proto_tree_add_item(mtree, hf_azureus_jpc_addrlen, tvb, offset, 4, FALSE);
-     proto_tree_add_item(mtree, hf_azureus_jpc_addr, tvb, offset+4, stringlen, FALSE);
-     proto_tree_add_item(mtree, hf_azureus_jpc_port, tvb, offset+4+stringlen, 4, FALSE);
-     proto_tree_add_item(mtree, hf_azureus_jpc_session, tvb, offset+4+stringlen+4, 4, FALSE);
-     break;
+      stringlen = tvb_get_ntohl(tvb, offset);
+      proto_tree_add_item(mtree, hf_azureus_jpc_addrlen, tvb, offset, 4, FALSE);
+      proto_tree_add_item(mtree, hf_azureus_jpc_addr, tvb, offset+4, stringlen, FALSE);
+      proto_tree_add_item(mtree, hf_azureus_jpc_port, tvb, offset+4+stringlen, 4, FALSE);
+      proto_tree_add_item(mtree, hf_azureus_jpc_session, tvb, offset+4+stringlen+4, 4, FALSE);
+      break;
 
    case AZUREUS_MESSAGE_JPC_REPLY:
-     proto_tree_add_item(mtree, hf_azureus_jpc_session, tvb, offset, 4, FALSE);
-     break;
+      proto_tree_add_item(mtree, hf_azureus_jpc_session, tvb, offset, 4, FALSE);
+      break;
 
    default:
       break;
@@ -759,12 +761,12 @@ static void dissect_bittorrent_welcome (tvbuff_t *tvb, packet_info *pinfo _U_, p
    if(decode_client_information) {
       for(i = 0; peer_id[i].id[0] != '\0'; ++i)
       {
-        if(tvb_memeql(tvb, offset, peer_id[i].id, (int)strlen(peer_id[i].id)) == 0) {
-           version = tvb_get_ephemeral_string(tvb, offset + (int)strlen(peer_id[i].id),
-              peer_id[i].ver_len);
+         if(tvb_memeql(tvb, offset, peer_id[i].id, (int)strlen(peer_id[i].id)) == 0) {
+            version = tvb_get_ephemeral_string(tvb, offset + (int)strlen(peer_id[i].id),
+                                               peer_id[i].ver_len);
             proto_tree_add_text(tree, tvb, offset, 20, "Client is %s v%s",
-               peer_id[i].name,
-              format_text((guchar*)version, peer_id[i].ver_len));
+                                peer_id[i].name,
+                                format_text((guchar*)version, peer_id[i].ver_len));
             break;
          }
       }
@@ -828,125 +830,124 @@ proto_register_bittorrent(void)
 {
    static hf_register_info hf[] = {
       { &hf_bittorrent_field_length,
-      { "Field Length", "bittorrent.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Field Length", "bittorrent.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_prot_name_len,
-      { "Protocol Name Length", "bittorrent.protocol.name.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Protocol Name Length", "bittorrent.protocol.name.length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_prot_name,
-      { "Protocol Name", "bittorrent.protocol.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Protocol Name", "bittorrent.protocol.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_reserved,
-      { "Reserved Extension Bytes", "bittorrent.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Reserved Extension Bytes", "bittorrent.reserved", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_sha1_hash,
-      { "SHA1 Hash of info dictionary", "bittorrent.info_hash", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "SHA1 Hash of info dictionary", "bittorrent.info_hash", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_peer_id,
-      { "Peer ID", "bittorrent.peer_id", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Peer ID", "bittorrent.peer_id", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_msg,
-      { "Message", "bittorrent.msg", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Message", "bittorrent.msg", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_msg_len,
-      { "Message Length", "bittorrent.msg.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Message Length", "bittorrent.msg.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_msg_type,
-      { "Message Type", "bittorrent.msg.type", FT_UINT8, BASE_DEC, VALS(bittorrent_messages), 0x0, NULL, HFILL }
+        { "Message Type", "bittorrent.msg.type", FT_UINT8, BASE_DEC, VALS(bittorrent_messages), 0x0, NULL, HFILL }
       },
       { &hf_azureus_msg,
-      { "Azureus Message", "bittorrent.azureus_msg", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Azureus Message", "bittorrent.azureus_msg", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_msg_type_len,
-      { "Message Type Length", "bittorrent.msg.typelen", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Message Type Length", "bittorrent.msg.typelen", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_msg_type,
-      { "Message Type", "bittorrent.msg.aztype", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Message Type", "bittorrent.msg.aztype", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_msg_prio,
-      { "Message Priority", "bittorrent.msg.prio", FT_UINT8, BASE_DEC, VALS(azureus_priorities), 0x0, NULL, HFILL }
+        { "Message Priority", "bittorrent.msg.prio", FT_UINT8, BASE_DEC, VALS(azureus_priorities), 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_bitfield_data,
-     { "Bitfield data", "bittorrent.msg.bitfield", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Bitfield data", "bittorrent.msg.bitfield", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_piece_index,
-      { "Piece index", "bittorrent.piece.index", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
+        { "Piece index", "bittorrent.piece.index", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_piece_begin,
-      { "Begin offset of piece", "bittorrent.piece.begin", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
+        { "Begin offset of piece", "bittorrent.piece.begin", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_piece_data,
-      { "Data in a piece", "bittorrent.piece.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Data in a piece", "bittorrent.piece.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_piece_length,
-         { "Piece Length", "bittorrent.piece.length", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
+        { "Piece Length", "bittorrent.piece.length", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_bstr_length,
-       { "String Length", "bittorrent.bstr.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "String Length", "bittorrent.bstr.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_bstr,
-       { "String", "bittorrent.bstr", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "String", "bittorrent.bstr", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_bint,
-       { "Integer", "bittorrent.bint", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Integer", "bittorrent.bint", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_bdict,
-       { "Dictionary", "bittorrent.bdict", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Dictionary", "bittorrent.bdict", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_bdict_entry,
-       { "Entry", "bittorrent.bdict.entry", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Entry", "bittorrent.bdict.entry", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_bittorrent_blist,
-       { "List", "bittorrent.blist", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "List", "bittorrent.blist", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_jpc_addrlen,
-       { "Cache Address Length", "bittorrent.jpc.addr.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Cache Address Length", "bittorrent.jpc.addr.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_jpc_addr,
-       { "Cache Address", "bittorrent.jpc.addr", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+        { "Cache Address", "bittorrent.jpc.addr", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_jpc_port,
-       { "Port", "bittorrent.jpc.port", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
+        { "Port", "bittorrent.jpc.port", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
       },
       { &hf_azureus_jpc_session,
-       { "Session ID", "bittorrent.jpc.session", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
+        { "Session ID", "bittorrent.jpc.session", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }
       }
-  };
-
-  static gint *ett[] = {
-    &ett_bittorrent,
-    &ett_bittorrent_msg,
-    &ett_peer_id,
-    &ett_bittorrent_bdict,
-    &ett_bittorrent_bdict_entry,
-    &ett_bittorrent_blist
-  };
-
-  module_t *bittorrent_module;
-
-  proto_bittorrent = proto_register_protocol("BitTorrent", "BitTorrent", "bittorrent");
-  proto_register_field_array(proto_bittorrent, hf, array_length(hf));
-  proto_register_subtree_array(ett, array_length(ett));
-
-  register_dissector("bittorrent.tcp", dissect_bittorrent, proto_bittorrent);
-
-  bittorrent_module = prefs_register_protocol(proto_bittorrent, NULL);
-  prefs_register_bool_preference(bittorrent_module, "desegment",
-    "Reassemble BitTorrent messages spanning multiple TCP segments",
-    "Whether the BitTorrent dissector should reassemble messages spanning multiple TCP segments."
-    " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
-    &bittorrent_desegment);
-  prefs_register_bool_preference(bittorrent_module, "decode_client",
-     "Decode the peer_id of the handshake messages",
-     "Enabling this will tell which BitTorrent client that produced the handshake message",
-     &decode_client_information);
+   };
+
+   static gint *ett[] = {
+      &ett_bittorrent,
+      &ett_bittorrent_msg,
+      &ett_peer_id,
+      &ett_bittorrent_bdict,
+      &ett_bittorrent_bdict_entry,
+      &ett_bittorrent_blist
+   };
+
+   module_t *bittorrent_module;
+
+   proto_bittorrent = proto_register_protocol("BitTorrent", "BitTorrent", "bittorrent");
+   proto_register_field_array(proto_bittorrent, hf, array_length(hf));
+   proto_register_subtree_array(ett, array_length(ett));
+
+   register_dissector("bittorrent.tcp", dissect_bittorrent, proto_bittorrent);
+
+   bittorrent_module = prefs_register_protocol(proto_bittorrent, NULL);
+   prefs_register_bool_preference(bittorrent_module, "desegment",
+                                  "Reassemble BitTorrent messages spanning multiple TCP segments",
+                                  "Whether the BitTorrent dissector should reassemble messages spanning multiple TCP segments."
+                                  " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
+                                  &bittorrent_desegment);
+   prefs_register_bool_preference(bittorrent_module, "decode_client",
+                                  "Decode the peer_id of the handshake messages",
+                                  "Enabling this will tell which BitTorrent client that produced the handshake message",
+                                  &decode_client_information);
 }
 
 
 void
 proto_reg_handoff_bittorrent(void)
 {
-/*   dissector_handle = create_dissector_handle(dissect_bittorrent, proto_bittorrent); */
    dissector_handle = find_dissector("bittorrent.tcp");
 #if 0
    dissector_add("tcp.port", 6881, dissector_handle);
@@ -961,3 +962,16 @@ proto_reg_handoff_bittorrent(void)
 #endif
    heur_dissector_add("tcp", test_bittorrent_packet, proto_bittorrent);
 }
+
+/*
+ * Editor modelines
+ *
+ * Local Variables:
+ * c-basic-offset: 3
+ * tab-width: 3
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=3 tabstop=3 expandtab
+ * :indentSize=3:tabSize=3:noTabs=true:
+ */
index 2e1b44274ead5b1408aa0a72e5d2bfbc41789c34..ad4283c83504bba1deff350bd0e670918dd1445a 100644 (file)
@@ -55,13 +55,13 @@ extern const char *gbl_nt_password;
 #define debugprintf(...) fprintf(stderr,__VA_ARGS__)
 static void printnbyte(const guint8* tab,int nb,const char* txt,const char* txt2)
 {
-  int i=0;
-  debugprintf("%s ",txt);
-  for(i=0;i<nb;i++)
-  {
-    debugprintf("%02hhX ",*(tab+i));
-  }
-  debugprintf("%s",txt2);
+    int i=0;
+    debugprintf("%s ",txt);
+    for(i=0;i<nb;i++)
+    {
+        debugprintf("%02hhX ",*(tab+i));
+    }
+    debugprintf("%s",txt2);
 }
 #else
 #define debugprintf(...)
@@ -72,34 +72,35 @@ static void printnbyte(const guint8* tab _U_,int nb _U_,const char* txt _U_,cons
 #define NETLOGON_FLAG_40000000 0x40000000
 #define NETLOGON_FLAG_20000000 0x20000000
 #define NETLOGON_FLAG_10000000 0x10000000
-#define NETLOGON_FLAG_8000000 0x8000000
-#define NETLOGON_FLAG_4000000 0x4000000
-#define NETLOGON_FLAG_2000000 0x2000000
-#define NETLOGON_FLAG_1000000 0x1000000
-#define NETLOGON_FLAG_800000 0x800000
-#define NETLOGON_FLAG_USEAES 0x400000
-#define NETLOGON_FLAG_200000 0x200000
-#define NETLOGON_FLAG_100000 0x100000
-#define NETLOGON_FLAG_80000 0x80000
-#define NETLOGON_FLAG_40000 0x40000
-#define NETLOGON_FLAG_20000 0x20000
-#define NETLOGON_FLAG_10000 0x10000
-#define NETLOGON_FLAG_8000 0x8000
-#define NETLOGON_FLAG_STRONGKEY 0x4000
-#define NETLOGON_FLAG_2000 0x2000
-#define NETLOGON_FLAG_1000 0x1000
-#define NETLOGON_FLAG_800 0x800
-#define NETLOGON_FLAG_400 0x400
-#define NETLOGON_FLAG_200 0x200
-#define NETLOGON_FLAG_100 0x100
-#define NETLOGON_FLAG_80 0x80
-#define NETLOGON_FLAG_40 0x40
-#define NETLOGON_FLAG_20 0x20
-#define NETLOGON_FLAG_10 0x10
-#define NETLOGON_FLAG_8 0x8
-#define NETLOGON_FLAG_4 0x4
-#define NETLOGON_FLAG_2 0x2
-#define NETLOGON_FLAG_1 0x1
+#define NETLOGON_FLAG_8000000   0x8000000
+#define NETLOGON_FLAG_4000000   0x4000000
+#define NETLOGON_FLAG_2000000   0x2000000
+#define NETLOGON_FLAG_1000000   0x1000000
+#define NETLOGON_FLAG_800000     0x800000
+#define NETLOGON_FLAG_USEAES     0x400000
+#define NETLOGON_FLAG_200000     0x200000
+#define NETLOGON_FLAG_100000     0x100000
+#define NETLOGON_FLAG_80000       0x80000
+#define NETLOGON_FLAG_40000       0x40000
+#define NETLOGON_FLAG_20000       0x20000
+#define NETLOGON_FLAG_10000       0x10000
+#define NETLOGON_FLAG_8000         0x8000
+#define NETLOGON_FLAG_STRONGKEY    0x4000
+#define NETLOGON_FLAG_2000         0x2000
+#define NETLOGON_FLAG_1000         0x1000
+#define NETLOGON_FLAG_800           0x800
+#define NETLOGON_FLAG_400           0x400
+#define NETLOGON_FLAG_200           0x200
+#define NETLOGON_FLAG_100           0x100
+#define NETLOGON_FLAG_80             0x80
+#define NETLOGON_FLAG_40             0x40
+#define NETLOGON_FLAG_20             0x20
+#define NETLOGON_FLAG_10             0x10
+#define NETLOGON_FLAG_8               0x8
+#define NETLOGON_FLAG_4               0x4
+#define NETLOGON_FLAG_2               0x2
+#define NETLOGON_FLAG_1               0x1
+
 static GHashTable *netlogon_auths=NULL;
 static GHashTable *schannel_auths;
 
@@ -440,21 +441,21 @@ static gint ett_get_dcname_request_flags = -1;
 static gint ett_dc_flags = -1;
 
 typedef struct _netlogon_auth_vars {
-  guint64 client_challenge;
-  guint64 server_challenge;
-  guint8  session_key[16];
-  guint8  encryption_key[16];
-  guint8  sequence[16];
-  guint32 flags;
-  guint64 seq;
-  guint64 confounder;
-  guint8 private_type;
-  gboolean can_decrypt;
-  void* private;
-  char* client_name;
-  int start;
-  int next_start;
-  struct _netlogon_auth_vars *next;
+    guint64 client_challenge;
+    guint64 server_challenge;
+    guint8  session_key[16];
+    guint8  encryption_key[16];
+    guint8  sequence[16];
+    guint32 flags;
+    guint64 seq;
+    guint64 confounder;
+    guint8 private_type;
+    gboolean can_decrypt;
+    void* private;
+    char* client_name;
+    int start;
+    int next_start;
+    struct _netlogon_auth_vars *next;
 } netlogon_auth_vars;
 
 typedef struct _md4_pass {
@@ -462,23 +463,23 @@ typedef struct _md4_pass {
 } md4_pass;
 
 typedef struct _seen_packet {
-  gboolean isseen;
-  guint32 num;
+    gboolean isseen;
+    guint32 num;
 } seen_packet;
 
 static seen_packet seen;
 guint
 netlogon_auth_hash (gconstpointer k);
 static e_uuid_t uuid_dcerpc_netlogon = {
-        0x12345678, 0x1234, 0xabcd,
-        { 0xef, 0x00, 0x01, 0x23, 0x45, 0x67, 0xcf, 0xfb }
+    0x12345678, 0x1234, 0xabcd,
+    { 0xef, 0x00, 0x01, 0x23, 0x45, 0x67, 0xcf, 0xfb }
 };
 
 static guint16 ver_dcerpc_netlogon = 1;
 
 static gint dissect_dcerpc_8bytes (tvbuff_t *tvb, gint offset, packet_info *pinfo _U_,
-                       proto_tree *tree, guint8 *drep,
-                       int hfindex, guint64 *pdata)
+                                   proto_tree *tree, guint8 *drep,
+                                   int hfindex, guint64 *pdata)
 {
     guint64 data;
 
@@ -495,72 +496,72 @@ static gint dissect_dcerpc_8bytes (tvbuff_t *tvb, gint offset, packet_info *pinf
 }
 
 static const true_false_string user_account_control_dont_require_preauth= {
-       "This account DOESN'T_REQUIRE_PREAUTHENTICATION",
-       "This account REQUIRES preauthentication",
+    "This account DOESN'T_REQUIRE_PREAUTHENTICATION",
+    "This account REQUIRES preauthentication",
 };
 static const true_false_string user_account_control_use_des_key_only= {
-       "This account must USE_DES_KEY_ONLY for passwords",
-       "This account does NOT have to use_des_key_only",
+    "This account must USE_DES_KEY_ONLY for passwords",
+    "This account does NOT have to use_des_key_only",
 };
 static const true_false_string user_account_control_not_delegated= {
-       "This account is NOT_DELEGATED",
-       "This might have been delegated",
+    "This account is NOT_DELEGATED",
+    "This might have been delegated",
 };
 static const true_false_string user_account_control_trusted_for_delegation= {
-       "This account is TRUSTED_FOR_DELEGATION",
-       "This account is NOT trusted_for_delegation",
+    "This account is TRUSTED_FOR_DELEGATION",
+    "This account is NOT trusted_for_delegation",
 };
 static const true_false_string user_account_control_smartcard_required= {
-       "This account REQUIRES_SMARTCARD to authenticate",
-       "This account does NOT require_smartcard to authenticate",
+    "This account REQUIRES_SMARTCARD to authenticate",
+    "This account does NOT require_smartcard to authenticate",
 };
 static const true_false_string user_account_control_encrypted_text_password_allowed= {
-       "This account allows ENCRYPTED_TEXT_PASSWORD",
-       "This account does NOT allow encrypted_text_password",
+    "This account allows ENCRYPTED_TEXT_PASSWORD",
+    "This account does NOT allow encrypted_text_password",
 };
 static const true_false_string user_account_control_account_auto_locked= {
-       "This account is AUTO_LOCKED",
-       "This account is NOT auto_locked",
+    "This account is AUTO_LOCKED",
+    "This account is NOT auto_locked",
 };
 static const true_false_string user_account_control_dont_expire_password= {
-       "This account DOESN'T_EXPIRE_PASSWORDs",
-       "This account might expire_passwords",
+    "This account DOESN'T_EXPIRE_PASSWORDs",
+    "This account might expire_passwords",
 };
 static const true_false_string user_account_control_server_trust_account= {
-       "This account is a SERVER_TRUST_ACCOUNT",
-       "This account is NOT a server_trust_account",
+    "This account is a SERVER_TRUST_ACCOUNT",
+    "This account is NOT a server_trust_account",
 };
 static const true_false_string user_account_control_workstation_trust_account= {
-       "This account is a WORKSTATION_TRUST_ACCOUNT",
-       "This account is NOT a workstation_trust_account",
+    "This account is a WORKSTATION_TRUST_ACCOUNT",
+    "This account is NOT a workstation_trust_account",
 };
 static const true_false_string user_account_control_interdomain_trust_account= {
-       "This account is an INTERDOMAIN_TRUST_ACCOUNT",
-       "This account is NOT an interdomain_trust_account",
+    "This account is an INTERDOMAIN_TRUST_ACCOUNT",
+    "This account is NOT an interdomain_trust_account",
 };
 static const true_false_string user_account_control_mns_logon_account= {
-       "This account is a MNS_LOGON_ACCOUNT",
-       "This account is NOT a mns_logon_account",
+    "This account is a MNS_LOGON_ACCOUNT",
+    "This account is NOT a mns_logon_account",
 };
 static const true_false_string user_account_control_normal_account= {
-       "This account is a NORMAL_ACCOUNT",
-       "This account is NOT a normal_account",
+    "This account is a NORMAL_ACCOUNT",
+    "This account is NOT a normal_account",
 };
 static const true_false_string user_account_control_temp_duplicate_account= {
-       "This account is a TEMP_DUPLICATE_ACCOUNT",
-       "This account is NOT a temp_duplicate_account",
+    "This account is a TEMP_DUPLICATE_ACCOUNT",
+    "This account is NOT a temp_duplicate_account",
 };
 static const true_false_string user_account_control_password_not_required= {
-       "This account REQUIRES_NO_PASSWORD",
-       "This account REQUIRES a password",
+    "This account REQUIRES_NO_PASSWORD",
+    "This account REQUIRES a password",
 };
 static const true_false_string user_account_control_home_directory_required= {
-       "This account REQUIRES_HOME_DIRECTORY",
-       "This account does NOT require_home_directory",
+    "This account REQUIRES_HOME_DIRECTORY",
+    "This account does NOT require_home_directory",
 };
 static const true_false_string user_account_control_account_disabled= {
-       "This account is DISABLED",
-       "This account is NOT disabled",
+    "This account is DISABLED",
+    "This account is NOT disabled",
 };
 
 typedef struct _netlogon_auth_key {
@@ -576,11 +577,11 @@ netlogon_auth_equal (gconstpointer k1, gconstpointer k2)
     const netlogon_auth_key *key1 = (const netlogon_auth_key *)k1;
     const netlogon_auth_key *key2 = (const netlogon_auth_key *)k2;
     if(key1->name == NULL || key2->name ==NULL)
-      return ((key1->dstport == key2->dstport) && ADDRESSES_EQUAL(&key1->src,&key2->src) &&
-            ADDRESSES_EQUAL(&key1->dst,&key2->dst));
+        return ((key1->dstport == key2->dstport) && ADDRESSES_EQUAL(&key1->src,&key2->src) &&
+                ADDRESSES_EQUAL(&key1->dst,&key2->dst));
     else
-      return ((strcmp(key1->name,key2->name)==0) && ADDRESSES_EQUAL(&key1->src,&key2->src) &&
-            ADDRESSES_EQUAL(&key1->dst,&key2->dst));
+        return ((strcmp(key1->name,key2->name)==0) && ADDRESSES_EQUAL(&key1->src,&key2->src) &&
+                ADDRESSES_EQUAL(&key1->dst,&key2->dst));
 }
 
 guint
@@ -589,14 +590,14 @@ netlogon_auth_hash (gconstpointer k)
     const netlogon_auth_key *key1 = (const netlogon_auth_key *)k;
     guint hash_val1;
     if(key1->name == NULL) {
-      hash_val1 = key1->dstport;
+        hash_val1 = key1->dstport;
     }
     else {
-      unsigned int i = 0;
-      hash_val1 = 0;
-      for(i=0; i<strlen(key1->name);i++) {
-        hash_val1 += key1->name[i];
-      }
+        unsigned int i = 0;
+        hash_val1 = 0;
+        for(i=0; i<strlen(key1->name);i++) {
+            hash_val1 += key1->name[i];
+        }
     }
 
     ADD_ADDRESS_TO_HASH(hash_val1, &key1->src);
@@ -605,172 +606,172 @@ netlogon_auth_hash (gconstpointer k)
 }
 static int
 netlogon_dissect_EXTRA_FLAGS(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *parent_tree, guint8 *drep)
-{
-       guint32 mask;
-       proto_item *item = NULL;
-       proto_tree *tree = NULL;
-       dcerpc_info *di;
-
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
-
-       offset=dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep,
-                       hf_netlogon_extraflags, &mask);
-
-       if(parent_tree){
-               item = proto_tree_add_uint(parent_tree, hf_netlogon_extraflags,
-                       tvb, offset-4, 4, mask);
-               tree = proto_item_add_subtree(item, ett_trust_flags);
-       }
-
-       proto_tree_add_boolean(tree, hf_netlogon_extra_flags_root_forest,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_trust_flags_dc_firsthop,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_trust_flags_rodc_to_dc,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_trust_flags_rodc_ntlm,
-               tvb, offset-4, 4, mask);
-
-       return offset;
+                             packet_info *pinfo, proto_tree *parent_tree, guint8 *drep)
+{
+    guint32 mask;
+    proto_item *item = NULL;
+    proto_tree *tree = NULL;
+    dcerpc_info *di;
+
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect */
+        return offset;
+    }
+
+    offset=dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep,
+                              hf_netlogon_extraflags, &mask);
+
+    if(parent_tree){
+        item = proto_tree_add_uint(parent_tree, hf_netlogon_extraflags,
+                                   tvb, offset-4, 4, mask);
+        tree = proto_item_add_subtree(item, ett_trust_flags);
+    }
+
+    proto_tree_add_boolean(tree, hf_netlogon_extra_flags_root_forest,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_trust_flags_dc_firsthop,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_trust_flags_rodc_to_dc,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_trust_flags_rodc_ntlm,
+                           tvb, offset-4, 4, mask);
+
+    return offset;
 }
 int
 dissect_ndr_lm_nt_hash_cb(tvbuff_t *tvb, int offset,
-            packet_info *pinfo, proto_tree *tree,
-            guint8 *drep, int hf_index,
-            dcerpc_callback_fnct_t *callback,
-            void *callback_args)
+                          packet_info *pinfo, proto_tree *tree,
+                          guint8 *drep, int hf_index,
+                          dcerpc_callback_fnct_t *callback,
+                          void *callback_args)
 {
-  dcerpc_info *di = pinfo->private_data;
-  guint16 len, size;
+    dcerpc_info *di = pinfo->private_data;
+    guint16 len, size;
 
-  /* Structure starts with short, but is aligned for longs */
+    /* Structure starts with short, but is aligned for longs */
 
-  ALIGN_TO_4_BYTES;
+    ALIGN_TO_4_BYTES;
 
-  if (di->conformant_run)
-    return offset;
+    if (di->conformant_run)
+        return offset;
 
-  /*
-           struct {
-               short len;
-               short size;
-               [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
-           } HASH;
+#if 0
+    struct {
+        short len;
+        short size;
+        [size_is(size/2), length_is(len/2), ptr] unsigned short *string;
+    } HASH;
 
-  */
+#endif
 
-  offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
-      hf_nt_cs_len, &len);
+    offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
+                                hf_nt_cs_len, &len);
 
-  offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
-      hf_nt_cs_size, &size);
+    offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
+                                hf_nt_cs_size, &size);
 
-  offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, tree, drep,
-      dissect_ndr_char_cvstring, NDR_POINTER_UNIQUE,
-      "Bytes Array", hf_index, callback, callback_args);
+    offset = dissect_ndr_pointer_cb(tvb, offset, pinfo, tree, drep,
+                                    dissect_ndr_char_cvstring, NDR_POINTER_UNIQUE,
+                                    "Bytes Array", hf_index, callback, callback_args);
 
-  return offset;
+    return offset;
 }
 static int
 dissect_ndr_lm_nt_hash_helper(tvbuff_t *tvb, int offset,
-          packet_info *pinfo, proto_tree *tree,
-          guint8 *drep, int hf_index, int levels _U_,
-          gboolean add_subtree)
+                              packet_info *pinfo, proto_tree *tree,
+                              guint8 *drep, int hf_index, int levels _U_,
+                              gboolean add_subtree)
 {
-  proto_item *item;
-  proto_tree *subtree = tree;
+    proto_item *item;
+    proto_tree *subtree = tree;
 
-  if (add_subtree) {
+    if (add_subtree) {
 
-    item = proto_tree_add_text(
-      tree, tvb, offset, 0, "%s",
-      proto_registrar_get_name(hf_index));
+        item = proto_tree_add_text(
+            tree, tvb, offset, 0, "%s",
+            proto_registrar_get_name(hf_index));
 
-    subtree = proto_item_add_subtree(item,ett_LM_OWF_PASSWORD);
-  }
+        subtree = proto_item_add_subtree(item,ett_LM_OWF_PASSWORD);
+    }
 
-  return dissect_ndr_lm_nt_hash_cb(
-    tvb, offset, pinfo, subtree, drep, hf_index,
-    NULL, NULL);
+    return dissect_ndr_lm_nt_hash_cb(
+        tvb, offset, pinfo, subtree, drep, hf_index,
+        NULL, NULL);
     /*cb_wstr_postprocess, GINT_TO_POINTER(2 + levels));*/
 }
 static int
 netlogon_dissect_USER_ACCOUNT_CONTROL(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *parent_tree, guint8 *drep)
-{
-       guint32 mask;
-       proto_item *item = NULL;
-       proto_tree *tree = NULL;
-       dcerpc_info *di;
-
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
-
-       offset=dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep,
-                       hf_netlogon_user_account_control, &mask);
-
-       if(parent_tree){
-               item = proto_tree_add_uint(parent_tree, hf_netlogon_user_account_control,
-                       tvb, offset-4, 4, mask);
-               tree = proto_item_add_subtree(item, ett_user_account_control);
-       }
-
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_dont_require_preauth,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_use_des_key_only,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_not_delegated,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_trusted_for_delegation,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_smartcard_required,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_encrypted_text_password_allowed,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_account_auto_locked,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_dont_expire_password,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_server_trust_account,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_workstation_trust_account,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_interdomain_trust_account,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_mns_logon_account,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_normal_account,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_temp_duplicate_account,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_password_not_required,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_home_directory_required,
-               tvb, offset-4, 4, mask);
-       proto_tree_add_boolean(tree, hf_netlogon_user_account_control_account_disabled,
-               tvb, offset-4, 4, mask);
-       return offset;
+                                      packet_info *pinfo, proto_tree *parent_tree, guint8 *drep)
+{
+    guint32 mask;
+    proto_item *item = NULL;
+    proto_tree *tree = NULL;
+    dcerpc_info *di;
+
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect */
+        return offset;
+    }
+
+    offset=dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep,
+                              hf_netlogon_user_account_control, &mask);
+
+    if(parent_tree){
+        item = proto_tree_add_uint(parent_tree, hf_netlogon_user_account_control,
+                                   tvb, offset-4, 4, mask);
+        tree = proto_item_add_subtree(item, ett_user_account_control);
+    }
+
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_dont_require_preauth,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_use_des_key_only,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_not_delegated,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_trusted_for_delegation,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_smartcard_required,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_encrypted_text_password_allowed,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_account_auto_locked,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_dont_expire_password,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_server_trust_account,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_workstation_trust_account,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_interdomain_trust_account,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_mns_logon_account,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_normal_account,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_temp_duplicate_account,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_password_not_required,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_home_directory_required,
+                           tvb, offset-4, 4, mask);
+    proto_tree_add_boolean(tree, hf_netlogon_user_account_control_account_disabled,
+                           tvb, offset-4, 4, mask);
+    return offset;
 }
 
 
 static int
 netlogon_dissect_LOGONSRV_HANDLE(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
+                                 packet_info *pinfo, proto_tree *tree,
+                                 guint8 *drep)
 {
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_UNIQUE, "Server Handle",
-               hf_netlogon_logonsrv_handle, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_UNIQUE, "Server Handle",
+                                          hf_netlogon_logonsrv_handle, 0);
 
-       return offset;
+    return offset;
 }
 
 /*
@@ -794,61 +795,61 @@ netlogon_dissect_LOGONSRV_HANDLE(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_VALIDATION_UAS_INFO(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
+                                     packet_info *pinfo, proto_tree *tree,
+                                     guint8 *drep)
 {
-       dcerpc_info *di;
+    dcerpc_info *di;
 
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect */
+        return offset;
+    }
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_UNIQUE, "Effective Account",
-               hf_netlogon_acct_name, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_UNIQUE, "Effective Account",
+                                          hf_netlogon_acct_name, 0);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_priv, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_priv, NULL);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_auth_flags, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_auth_flags, NULL);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_logon_count, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_logon_count, NULL);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_bad_pw_count, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_bad_pw_count, NULL);
 
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_logon_time, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_logon_time, NULL);
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_last_logoff_time, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_last_logoff_time, NULL);
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_logoff_time, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_logoff_time, NULL);
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_kickoff_time, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_kickoff_time, NULL);
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_pwd_age, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_pwd_age, NULL);
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_pwd_can_change_time, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_pwd_can_change_time, NULL);
 
-       offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_pwd_must_change_time, NULL);
+    offset = dissect_ndr_time_t(tvb, offset, pinfo, tree, drep, hf_netlogon_pwd_must_change_time, NULL);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_UNIQUE, "Computer", hf_netlogon_computer_name, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_UNIQUE, "Computer", hf_netlogon_computer_name, 0);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_UNIQUE, "Domain", hf_netlogon_domain_name, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_UNIQUE, "Domain", hf_netlogon_domain_name, 0);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_UNIQUE, "Script", hf_netlogon_logon_script, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_UNIQUE, "Script", hf_netlogon_logon_script, 0);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_reserved, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_reserved, NULL);
 
-       return offset;
+    return offset;
 }
 
 /*
@@ -861,33 +862,33 @@ netlogon_dissect_VALIDATION_UAS_INFO(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_netrlogonuaslogon_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, guint8 *drep)
+                                        packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
-       offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
+                                              pinfo, tree, drep);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_REF, "Account", hf_netlogon_acct_name, CB_STR_COL_INFO);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_REF, "Account", hf_netlogon_acct_name, CB_STR_COL_INFO);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_REF, "Workstation", hf_netlogon_workstation, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_REF, "Workstation", hf_netlogon_workstation, 0);
 
-       return offset;
+    return offset;
 }
 
 
 static int
 netlogon_dissect_netrlogonuaslogon_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, guint8 *drep)
+                                         packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
-       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-               netlogon_dissect_VALIDATION_UAS_INFO, NDR_POINTER_UNIQUE,
-               "VALIDATION_UAS_INFO", -1);
+    offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                                 netlogon_dissect_VALIDATION_UAS_INFO, NDR_POINTER_UNIQUE,
+                                 "VALIDATION_UAS_INFO", -1);
 
-       offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
-                                 hf_netlogon_dos_rc, NULL);
+    offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
+                              hf_netlogon_dos_rc, NULL);
 
-       return offset;
+    return offset;
 }
 
 /*
@@ -898,24 +899,24 @@ netlogon_dissect_netrlogonuaslogon_reply(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_LOGOFF_UAS_INFO(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
+                                 packet_info *pinfo, proto_tree *tree,
+                                 guint8 *drep)
 {
-       dcerpc_info *di;
+    dcerpc_info *di;
 
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect */
-               return offset;
-       }
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect */
+        return offset;
+    }
 
-       proto_tree_add_text(tree, tvb, offset, 4, "Duration: unknown time format");
-       offset+= 4;
+    proto_tree_add_text(tree, tvb, offset, 4, "Duration: unknown time format");
+    offset+= 4;
 
-       offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_logon_count16, NULL);
+    offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_logon_count16, NULL);
 
-       return offset;
+    return offset;
 }
 
 /*
@@ -928,55 +929,55 @@ netlogon_dissect_LOGOFF_UAS_INFO(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_netrlogonuaslogoff_rqst(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, guint8 *drep)
+                                         packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
-       offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
+                                              pinfo, tree, drep);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_REF, "Account", hf_netlogon_acct_name, CB_STR_COL_INFO);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_REF, "Account", hf_netlogon_acct_name, CB_STR_COL_INFO);
 
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_REF, "Workstation", hf_netlogon_workstation, 0);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_REF, "Workstation", hf_netlogon_workstation, 0);
 
-       return offset;
+    return offset;
 }
 
 
 static int
 netlogon_dissect_netrlogonuaslogoff_reply(tvbuff_t *tvb, int offset,
-       packet_info *pinfo, proto_tree *tree, guint8 *drep)
+                                          packet_info *pinfo, proto_tree *tree, guint8 *drep)
 {
-       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-               netlogon_dissect_LOGOFF_UAS_INFO, NDR_POINTER_REF,
-               "LOGOFF_UAS_INFO", -1);
+    offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                                 netlogon_dissect_LOGOFF_UAS_INFO, NDR_POINTER_REF,
+                                 "LOGOFF_UAS_INFO", -1);
 
-       offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
-                                 hf_netlogon_dos_rc, NULL);
+    offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep,
+                              hf_netlogon_dos_rc, NULL);
 
-       return offset;
+    return offset;
 }
 
 static int
 netlogon_dissect_BYTE_byte(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
+                           packet_info *pinfo, proto_tree *tree,
+                           guint8 *drep)
 {
-       offset = dissect_ndr_uint8(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_unknown_char, NULL);
+    offset = dissect_ndr_uint8(tvb, offset, pinfo, tree, drep,
+                               hf_netlogon_unknown_char, NULL);
 
-       return offset;
+    return offset;
 }
 
 static int
 netlogon_dissect_BYTE_array(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
+                            packet_info *pinfo, proto_tree *tree,
+                            guint8 *drep)
 {
-       offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
-               netlogon_dissect_BYTE_byte);
+    offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
+                                 netlogon_dissect_BYTE_byte);
 
-       return offset;
+    return offset;
 }
 
 
@@ -993,49 +994,49 @@ netlogon_dissect_BYTE_array(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_LOGON_IDENTITY_INFO(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *parent_tree,
-                       guint8 *drep)
+                                     packet_info *pinfo, proto_tree *parent_tree,
+                                     guint8 *drep)
 {
-       proto_item *item=NULL;
-       proto_tree *tree=NULL;
-       int old_offset=offset;
+    proto_item *item=NULL;
+    proto_tree *tree=NULL;
+    int old_offset=offset;
 
-       if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "IDENTITY_INFO:");
-               tree = proto_item_add_subtree(item, ett_IDENTITY_INFO);
-       }
+    if(parent_tree){
+        item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+                                   "IDENTITY_INFO:");
+        tree = proto_item_add_subtree(item, ett_IDENTITY_INFO);
+    }
 
-       /* XXX: It would be nice to get the domain and account name
-           displayed in COL_INFO. */
+    /* XXX: It would be nice to get the domain and account name
+       displayed in COL_INFO. */
 
-       offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_logon_dom, 0);
+    offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
+                                        hf_netlogon_logon_dom, 0);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_param_ctrl, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_param_ctrl, NULL);
 
-       offset = dissect_ndr_duint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_logon_id, NULL);
+    offset = dissect_ndr_duint32(tvb, offset, pinfo, tree, drep,
+                                 hf_netlogon_logon_id, NULL);
 
-       offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_acct_name, 1);
+    offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
+                                        hf_netlogon_acct_name, 1);
 
-       offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_workstation, 0);
+    offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
+                                        hf_netlogon_workstation, 0);
 
 #ifdef REMOVED
-       /* NetMon does not recognize these bytes. Ill comment them out until someone complains */
-       /* XXX 8 extra bytes here */
-       /* there were 8 extra bytes, either here or in NETWORK_INFO that does not match
-          the idl file. Could be a bug in either the NETLOGON implementation or in the
-          idl file.
-       */
-       offset = netlogon_dissect_8_unknown_bytes(tvb, offset, pinfo, tree, drep);
+    /* NetMon does not recognize these bytes. Ill comment them out until someone complains */
+    /* XXX 8 extra bytes here */
+    /* there were 8 extra bytes, either here or in NETWORK_INFO that does not match
+       the idl file. Could be a bug in either the NETLOGON implementation or in the
+       idl file.
+    */
+    offset = netlogon_dissect_8_unknown_bytes(tvb, offset, pinfo, tree, drep);
 #endif
 
-       proto_item_set_len(item, offset-old_offset);
-       return offset;
+    proto_item_set_len(item, offset-old_offset);
+    return offset;
 }
 
 
@@ -1046,30 +1047,30 @@ netlogon_dissect_LOGON_IDENTITY_INFO(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_LM_OWF_PASSWORD(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *parent_tree,
-                       guint8 *drep _U_)
+                                 packet_info *pinfo, proto_tree *parent_tree,
+                                 guint8 *drep _U_)
 {
-       proto_item *item=NULL;
-       proto_tree *tree=NULL;
-       dcerpc_info *di;
+    proto_item *item=NULL;
+    proto_tree *tree=NULL;
+    dcerpc_info *di;
 
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect.*/
-               return offset;
-       }
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect.*/
+        return offset;
+    }
 
-       if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 16,
-                       "LM_OWF_PASSWORD:");
-               tree = proto_item_add_subtree(item, ett_LM_OWF_PASSWORD);
-       }
+    if(parent_tree){
+        item = proto_tree_add_text(parent_tree, tvb, offset, 16,
+                                   "LM_OWF_PASSWORD:");
+        tree = proto_item_add_subtree(item, ett_LM_OWF_PASSWORD);
+    }
 
-       proto_tree_add_item(tree, hf_netlogon_lm_owf_password, tvb, offset, 16,
-               FALSE);
-       offset += 16;
+    proto_tree_add_item(tree, hf_netlogon_lm_owf_password, tvb, offset, 16,
+                        FALSE);
+    offset += 16;
 
-       return offset;
+    return offset;
 }
 
 /*
@@ -1079,30 +1080,30 @@ netlogon_dissect_LM_OWF_PASSWORD(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_NT_OWF_PASSWORD(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *parent_tree,
-                       guint8 *drep _U_)
+                                 packet_info *pinfo, proto_tree *parent_tree,
+                                 guint8 *drep _U_)
 {
-       proto_item *item=NULL;
-       proto_tree *tree=NULL;
-       dcerpc_info *di;
+    proto_item *item=NULL;
+    proto_tree *tree=NULL;
+    dcerpc_info *di;
 
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect.*/
-               return offset;
-       }
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect.*/
+        return offset;
+    }
 
-       if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 16,
-                       "NT_OWF_PASSWORD:");
-               tree = proto_item_add_subtree(item, ett_NT_OWF_PASSWORD);
-       }
+    if(parent_tree){
+        item = proto_tree_add_text(parent_tree, tvb, offset, 16,
+                                   "NT_OWF_PASSWORD:");
+        tree = proto_item_add_subtree(item, ett_NT_OWF_PASSWORD);
+    }
 
-       proto_tree_add_item(tree, hf_netlogon_nt_owf_password, tvb, offset, 16,
-               FALSE);
-       offset += 16;
+    proto_tree_add_item(tree, hf_netlogon_nt_owf_password, tvb, offset, 16,
+                        FALSE);
+    offset += 16;
 
-       return offset;
+    return offset;
 }
 
 
@@ -1115,19 +1116,19 @@ netlogon_dissect_NT_OWF_PASSWORD(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_INTERACTIVE_INFO(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
+                                  packet_info *pinfo, proto_tree *tree,
+                                  guint8 *drep)
 {
-       offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
+                                                  pinfo, tree, drep);
 
-       offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
+                                              pinfo, tree, drep);
 
-       offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, offset,
+                                              pinfo, tree, drep);
 
-       return offset;
+    return offset;
 }
 
 /*
@@ -1137,22 +1138,22 @@ netlogon_dissect_INTERACTIVE_INFO(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_CHALLENGE(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep _U_)
+                           packet_info *pinfo, proto_tree *tree,
+                           guint8 *drep _U_)
 {
-       dcerpc_info *di;
+    dcerpc_info *di;
 
-       di=pinfo->private_data;
-       if(di->conformant_run){
-               /*just a run to handle conformant arrays, nothing to dissect.*/
-               return offset;
-       }
+    di=pinfo->private_data;
+    if(di->conformant_run){
+        /*just a run to handle conformant arrays, nothing to dissect.*/
+        return offset;
+    }
 
-       proto_tree_add_item(tree, hf_netlogon_challenge, tvb, offset, 8,
-               FALSE);
-       offset += 8;
+    proto_tree_add_item(tree, hf_netlogon_challenge, tvb, offset, 8,
+                        FALSE);
+    offset += 8;
 
-       return offset;
+    return offset;
 }
 
 #if 0
@@ -1165,88 +1166,87 @@ netlogon_dissect_CHALLENGE(tvbuff_t *tvb, int offset,
  * IDL } NETWORK_INFO;
  */
 static void dissect_nt_chal_resp_cb(packet_info *pinfo _U_, proto_tree *tree,
-                                   proto_item *item _U_, tvbuff_t *tvb,
-                                   int start_offset, int end_offset,
-                                   void *callback_args )
+                                    proto_item *item _U_, tvbuff_t *tvb,
+                                    int start_offset, int end_offset,
+                                    void *callback_args )
 {
-  int len;
-  gint options = GPOINTER_TO_INT(callback_args);
-  gint levels = CB_STR_ITEM_LEVELS(options);
-  char *s;
+    int len;
+    gint options = GPOINTER_TO_INT(callback_args);
+    gint levels = CB_STR_ITEM_LEVELS(options);
+    char *s;
 
 
-  /* Skip over 3 guint32's in NDR format */
+    /* Skip over 3 guint32's in NDR format */
 
-  if (start_offset % 4)
-    start_offset += 4 - (start_offset % 4);
+    if (start_offset % 4)
+        start_offset += 4 - (start_offset % 4);
 
-  start_offset += 12;
-  len = end_offset - start_offset;
+    start_offset += 12;
+    len = end_offset - start_offset;
 
-  s = tvb_bytes_to_str(tvb, start_offset, len);
+    s = tvb_bytes_to_str(tvb, start_offset, len);
 
-  /* Append string to upper-level proto_items */
+    /* Append string to upper-level proto_items */
 
-  if (levels > 0 && item && s && s[0]) {
-    proto_item_append_text(item, ": %s", s);
-    item = item->parent;
-    levels--;
-    if (levels > 0) {
-      proto_item_append_text(item, ": %s", s);
-      item = item->parent;
-      levels--;
-      while (levels > 0) {
-        proto_item_append_text(item, " %s", s);
+    if (levels > 0 && item && s && s[0]) {
+        proto_item_append_text(item, ": %s", s);
         item = item->parent;
         levels--;
-      }
+        if (levels > 0) {
+            proto_item_append_text(item, ": %s", s);
+            item = item->parent;
+            levels--;
+            while (levels > 0) {
+                proto_item_append_text(item, " %s", s);
+                item = item->parent;
+                levels--;
+            }
+        }
     }
-  }
-  /* Call ntlmv2 response dissector */
+    /* Call ntlmv2 response dissector */
 
-  if (len > 24)
-    dissect_ntlmv2_response(tvb, tree, start_offset, len);
+    if (len > 24)
+        dissect_ntlmv2_response(tvb, tree, start_offset, len);
 }
 #endif
 
 static int
 netlogon_dissect_NETWORK_INFO(tvbuff_t *tvb, int offset,
-               packet_info *pinfo, proto_tree *tree,
-               guint8 *drep)
+                              packet_info *pinfo, proto_tree *tree,
+                              guint8 *drep)
 {
 
-       offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
-               pinfo, tree, drep);
-       offset = netlogon_dissect_CHALLENGE(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
+                                                  pinfo, tree, drep);
+    offset = netlogon_dissect_CHALLENGE(tvb, offset,
+                                        pinfo, tree, drep);
 #if 0
-       offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
-               NDR_POINTER_UNIQUE, "NT ",
-               hf_netlogon_nt_owf_password, 0);
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_data_length, NULL);
+    offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
+                                          NDR_POINTER_UNIQUE, "NT ",
+                                          hf_netlogon_nt_owf_password, 0);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_data_length, NULL);
 #endif
-       offset = dissect_ndr_lm_nt_hash_helper(tvb,offset,pinfo, tree, drep, hf_netlogon_lm_chal_resp, 0,TRUE);
-       offset = dissect_ndr_lm_nt_hash_helper(tvb,offset,pinfo, tree, drep, hf_netlogon_lm_chal_resp, 0,TRUE);
-       /* Not really sure that it really works with NTLM v2 ....*/
+    offset = dissect_ndr_lm_nt_hash_helper(tvb,offset,pinfo, tree, drep, hf_netlogon_lm_chal_resp, 0,TRUE);
+    offset = dissect_ndr_lm_nt_hash_helper(tvb,offset,pinfo, tree, drep, hf_netlogon_lm_chal_resp, 0,TRUE);
+    /* Not really sure that it really works with NTLM v2 ....*/
 #if 0
-       offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
+                                              pinfo, tree, drep);
 
-       offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, offset,
+                                              pinfo, tree, drep);
 #endif
-       return offset;
+    return offset;
 #if 0
-       offset = dissect_ndr_counted_byte_array_cb(
-               tvb, offset, pinfo, tree, drep, hf_netlogon_nt_chal_resp,
-       dissect_nt_chal_resp_cb,GINT_TO_POINTER(2));
-               hf_netlogon_nt_chal_resp, 0);
+    offset = dissect_ndr_counted_byte_array_cb(
+        tvb, offset, pinfo, tree, drep, hf_netlogon_nt_chal_resp,
+        dissect_nt_chal_resp_cb,GINT_TO_POINTER(2));
 
-       offset = dissect_ndr_counted_byte_array(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_lm_chal_resp, 0);
+    offset = dissect_ndr_counted_byte_array(tvb, offset, pinfo, tree, drep,
+                                            hf_netlogon_lm_chal_resp, 0);
 
-       return offset;
+    return offset;
 #endif
 }
 
@@ -1260,45 +1260,45 @@ netlogon_dissect_NETWORK_INFO(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_SERVICE_INFO(tvbuff_t *tvb, int offset,
-               packet_info *pinfo, proto_tree *tree,
-               guint8 *drep)
+                              packet_info *pinfo, proto_tree *tree,
+                              guint8 *drep)
 {
-       offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
+                                                  pinfo, tree, drep);
 
-       offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LM_OWF_PASSWORD(tvb, offset,
+                                              pinfo, tree, drep);
 
-       offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_NT_OWF_PASSWORD(tvb, offset,
+                                              pinfo, tree, drep);
 
-       return offset;
+    return offset;
 }
 
 static int
 netlogon_dissect_GENERIC_INFO(tvbuff_t *tvb, int offset,
-               packet_info *pinfo, proto_tree *tree,
-               guint8 *drep)
+                              packet_info *pinfo, proto_tree *tree,
+                              guint8 *drep)
 {
-       dcerpc_info *di;
-       dcerpc_call_value *dcv;
+    dcerpc_info *di;
+    dcerpc_call_value *dcv;
 
-       di=pinfo->private_data;
-       dcv = (dcerpc_call_value *)di->call_data;
+    di=pinfo->private_data;
+    dcv = (dcerpc_call_value *)di->call_data;
 
-       offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
-               pinfo, tree, drep);
+    offset = netlogon_dissect_LOGON_IDENTITY_INFO(tvb, offset,
+                                                  pinfo, tree, drep);
 
-       offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_package_name, 0|CB_STR_SAVE);
+    offset = dissect_ndr_counted_string(tvb, offset, pinfo, tree, drep,
+                                        hf_netlogon_package_name, 0|CB_STR_SAVE);
 
-       offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_data_length, NULL);
+    offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+                                hf_netlogon_data_length, NULL);
 
-       offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-               netlogon_dissect_BYTE_array, NDR_POINTER_REF,
-               "Logon Data", -1);
-       return offset;
+    offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
+                                 netlogon_dissect_BYTE_array, NDR_POINTER_REF,
+                                 "Logon Data", -1);
+    return offset;
 }
 /*
  * IDL typedef [switch_type(short)] union {
@@ -1309,51 +1309,51 @@ netlogon_dissect_GENERIC_INFO(tvbuff_t *tvb, int offset,
  */
 static int
 netlogon_dissect_LEVEL(tvbuff_t *tvb, int offset,
-                       packet_info *pinfo, proto_tree *tree,
-                       guint8 *drep)
-{
-       guint16 level;
-
-       offset = dissect_ndr_uint16(tvb, offset, pinfo, tree, drep,
-               hf_netlogon_level16, &level);
-       ALIGN_TO_4_BYTES;
-       switch(level){
-       case 1:
-               offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       netlogon_dissect_INTERACTIVE_INFO, NDR_POINTER_UNIQUE,