Fix document creation under Windows, add ethereal-filter.html to the NSIS
[obnox/wireshark/wip.git] / packet-ospf.c
index 3b7c912ed2ded5b04c9c0e38cfcde841f7a81058..3203a0ea1a3a0c0eefb8f0d7cf21fff670749f4f 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for OSPF packet disassembly
  * (c) Copyright Hannes R. Boehm <hannes@boehm.org>
  *
- * $Id: packet-ospf.c,v 1.58 2002/02/19 21:56:56 ashokn Exp $
+ * $Id: packet-ospf.c,v 1.75 2003/05/08 10:16:31 guy Exp $
  *
  * At this time, this module is able to analyze OSPF
  * packets as specified in RFC2328. MOSPF (RFC1584) and other
  *   - (c) 2001 Palle Lyckegaard <palle[AT]lyckegaard.dk>
  *
  * TOS - support is not fully implemented
- * 
+ *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
 #include <stdio.h>
 #include <string.h>
 
@@ -51,7 +43,7 @@
 #include <epan/packet.h>
 #include "ipproto.h"
 #include "in_cksum.h"
-#include "ieee-float.h"
+#include "packet-rsvp.h"
 
 #define OSPF_VERSION_2 2
 #define OSPF_VERSION_3 3
@@ -85,14 +77,14 @@ static const value_string auth_vals[] = {
        {0,                NULL              }
 };
 
+#define OSPF_V2_OPTIONS_DN             0x01
 #define OSPF_V2_OPTIONS_E              0x02
 #define OSPF_V2_OPTIONS_MC             0x04
 #define OSPF_V2_OPTIONS_NP             0x08
 #define OSPF_V2_OPTIONS_EA             0x10
 #define OSPF_V2_OPTIONS_DC             0x20
 #define OSPF_V2_OPTIONS_O              0x40
-#define OSPF_V2_OPTIONS_DN             0x01
-#define OSPF_V3_OPTIONS_V6              0x01    
+#define OSPF_V3_OPTIONS_V6              0x01
 #define OSPF_V3_OPTIONS_E              0x02
 #define OSPF_V3_OPTIONS_MC             0x04
 #define OSPF_V3_OPTIONS_N              0x08
@@ -119,7 +111,7 @@ static const value_string auth_vals[] = {
 #define OSPF_V3_LSTYPE_INTER_AREA_PREFIX     0x2003
 #define OSPF_V3_LSTYPE_INTER_AREA_ROUTER     0x2004
 #define OSPF_V3_LSTYPE_AS_EXTERNAL           0x4005
-#define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP      0x2006     
+#define OSPF_V3_LSTYPE_GROUP_MEMBERSHIP      0x2006
 #define OSPF_V3_LSTYPE_TYPE_7                0x2007
 #define OSPF_V3_LSTYPE_LINK                  0x0008
 #define OSPF_V3_LSTYPE_INTRA_AREA_PREFIX     0x2009
@@ -160,14 +152,21 @@ static const value_string ls_type_vals[] = {
 
 };
 
+static const value_string ls_opaque_type_vals[] = {
+       {OSPF_LSA_MPLS_TE, "Traffic Engineering LSA"                },
+       {2,                "Sycamore Optical Topology Descriptions" },
+       {3,                "grace-LSA"                              },
+       {0,                NULL                                     }
+};
+
 static const value_string v3_ls_type_vals[] = {
-       {OSPF_V3_LSTYPE_ROUTER,               "Router-LSA"                   }, 
-       {OSPF_V3_LSTYPE_NETWORK,              "Network-LSA"                  }, 
-       {OSPF_V3_LSTYPE_INTER_AREA_PREFIX,    "Inter-Area-Prefix-LSA"        }, 
-       {OSPF_V3_LSTYPE_INTER_AREA_ROUTER,    "Inter-Area-Router-LSA"        }, 
-       {OSPF_V3_LSTYPE_AS_EXTERNAL,          "AS-External-LSA"              }, 
-       {OSPF_V3_LSTYPE_GROUP_MEMBERSHIP,     "Group-Membership-LSA"         }, 
-       {OSPF_V3_LSTYPE_TYPE_7,               "Type-LSA"                     }, 
+       {OSPF_V3_LSTYPE_ROUTER,               "Router-LSA"                   },
+       {OSPF_V3_LSTYPE_NETWORK,              "Network-LSA"                  },
+       {OSPF_V3_LSTYPE_INTER_AREA_PREFIX,    "Inter-Area-Prefix-LSA"        },
+       {OSPF_V3_LSTYPE_INTER_AREA_ROUTER,    "Inter-Area-Router-LSA"        },
+       {OSPF_V3_LSTYPE_AS_EXTERNAL,          "AS-External-LSA"              },
+       {OSPF_V3_LSTYPE_GROUP_MEMBERSHIP,     "Group-Membership-LSA"         },
+       {OSPF_V3_LSTYPE_TYPE_7,               "Type-LSA"                     },
        {OSPF_V3_LSTYPE_LINK,                 "Link-LSA"                     },
        {OSPF_V3_LSTYPE_INTRA_AREA_PREFIX,    "Intra-Area-Prefix-LSA"        },
        {0,                                   NULL                           }
@@ -198,6 +197,7 @@ static gint ett_ospf_hello = -1;
 static gint ett_ospf_desc = -1;
 static gint ett_ospf_lsr = -1;
 static gint ett_ospf_lsa = -1;
+static gint ett_ospf_lsa_router_link = -1;
 static gint ett_ospf_lsa_upd = -1;
 
 /* Trees for opaque LSAs */
@@ -206,21 +206,193 @@ static gint ett_ospf_lsa_mpls_router = -1;
 static gint ett_ospf_lsa_mpls_link = -1;
 static gint ett_ospf_lsa_mpls_link_stlv = -1;
 
+/*-----------------------------------------------------------------------
+ * OSPF Filtering
+ *-----------------------------------------------------------------------*/
+
+/* The OSPF filtering keys */
+enum {
+
+    OSPFF_MSG_TYPE,
+
+    OSPFF_MSG_MIN,
+    OSPFF_MSG_HELLO,
+    OSPFF_MSG_DB_DESC,
+    OSPFF_MSG_LS_REQ,
+    OSPFF_MSG_LS_UPD,
+    OSPFF_MSG_LS_ACK,
+
+    OSPFF_LS_TYPE,
+    OSPFF_LS_OPAQUE_TYPE,
+
+    OSPFF_LS_MPLS_TE_INSTANCE,
+
+    OSPFF_LS_MIN,
+    OSPFF_LS_ROUTER,
+    OSPFF_LS_NETWORK,
+    OSPFF_LS_SUMMARY,
+    OSPFF_LS_ASBR,
+    OSPFF_LS_ASEXT,
+    OSPFF_LS_GRPMEMBER,
+    OSPFF_LS_ASEXT7,
+    OSPFF_LS_EXTATTR,
+    OSPFF_LS_OPAQUE,
+
+    OSPFF_SRC_ROUTER,
+    OSPFF_ADV_ROUTER,
+    OSPFF_LS_MPLS,
+    OSPFF_LS_MPLS_ROUTERID,
+
+    OSPFF_LS_MPLS_LINKID,
+    OSPFF_LS_MPLS_LOCAL_ADDR,
+    OSPFF_LS_MPLS_REMOTE_ADDR,
+    OSPFF_LS_MPLS_LOCAL_IFID,
+    OSPFF_LS_MPLS_REMOTE_IFID,
+
+    OSPFF_MAX
+};
+
+static int ospf_filter[OSPFF_MAX];
+
+static hf_register_info ospff_info[] = {
+
+    /* Message type number */
+    {&ospf_filter[OSPFF_MSG_TYPE],
+     { "Message Type", "ospf.msg", FT_UINT8, BASE_DEC, VALS(pt_vals), 0x0,
+       "", HFILL }},
+
+    /* Message types */
+    {&ospf_filter[OSPFF_MSG_HELLO],
+     { "Hello", "ospf.msg.hello", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_MSG_DB_DESC],
+     { "Database Description", "ospf.msg.dbdesc", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_MSG_LS_REQ],
+     { "Link State Adv Request", "ospf.msg.lsreq", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_MSG_LS_UPD],
+     { "Link State Adv Update", "ospf.msg.lsupdate", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_MSG_LS_ACK],
+     { "Link State Adv Acknowledgement", "ospf.msg.lsack", FT_BOOLEAN,
+       BASE_NONE, NULL, 0x0, "", HFILL }},
+
+
+
+    /* LS Types */
+    {&ospf_filter[OSPFF_LS_TYPE],
+     { "Link-State Advertisement Type", "ospf.lsa", FT_UINT8, BASE_DEC,
+       VALS(ls_type_vals), 0x0, "", HFILL }},
+    {&ospf_filter[OSPFF_LS_OPAQUE_TYPE],
+     { "Link State ID Opaque Type", "ospf.lsid_opaque_type", FT_UINT8, BASE_DEC,
+       VALS(ls_opaque_type_vals), 0x0, "", HFILL }},
+
+    {&ospf_filter[OSPFF_LS_MPLS_TE_INSTANCE],
+     { "Link State ID TE-LSA Instance", "ospf.lsid_te_lsa.instance", FT_UINT16, BASE_DEC,
+       NULL, 0x0, "", HFILL }},
+
+    {&ospf_filter[OSPFF_LS_ROUTER],
+     { "Router LSA", "ospf.lsa.router", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_NETWORK],
+     { "Network LSA", "ospf.lsa.network", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_SUMMARY],
+     { "Summary LSA (IP Network)", "ospf.lsa.summary", FT_BOOLEAN, BASE_NONE,
+       NULL, 0x0, "", HFILL }},
+    {&ospf_filter[OSPFF_LS_ASBR],
+     { "Summary LSA (ASBR)", "ospf.lsa.asbr", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_ASEXT],
+     { "AS-External LSA (ASBR)", "ospf.lsa.asext", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_GRPMEMBER],
+     { "Group Membership LSA", "ospf.lsa.member", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_ASEXT7],
+     { "NSSA AS-External LSA", "ospf.lsa.nssa", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_EXTATTR],
+     { "External Attributes LSA", "ospf.lsa.attr", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_OPAQUE],
+     { "Opaque LSA", "ospf.lsa.opaque", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+
+    /* Other interesting OSPF values */
+
+    {&ospf_filter[OSPFF_SRC_ROUTER],
+     { "Source OSPF Router", "ospf.srcrouter", FT_IPv4, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+
+    {&ospf_filter[OSPFF_ADV_ROUTER],
+     { "Advertising Router", "ospf.advrouter", FT_IPv4, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+
+   {&ospf_filter[OSPFF_LS_MPLS],
+     { "MPLS Traffic Engineering LSA", "ospf.lsa.mpls", FT_BOOLEAN,
+       BASE_NONE, NULL, 0x0, "", HFILL }},
+
+    {&ospf_filter[OSPFF_LS_MPLS_ROUTERID],
+     { "MPLS/TE Router ID", "ospf.mpls.routerid", FT_IPv4, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+
+    {&ospf_filter[OSPFF_LS_MPLS_LINKID],
+     { "MPLS/TE Link ID", "ospf.mpls.linkid", FT_IPv4, BASE_NONE, NULL, 0x0,
+       "", HFILL }},
+    {&ospf_filter[OSPFF_LS_MPLS_LOCAL_ADDR],
+     { "MPLS/TE Local Interface Address", "ospf.mpls.local_addr", FT_IPv4,
+       BASE_NONE, NULL, 0x0, "", HFILL }},
+    {&ospf_filter[OSPFF_LS_MPLS_REMOTE_ADDR],
+     { "MPLS/TE Remote Interface Address", "ospf.mpls.remote_addr", FT_IPv4,
+       BASE_NONE, NULL, 0x0, "", HFILL }},
+    {&ospf_filter[OSPFF_LS_MPLS_LOCAL_IFID],
+     { "MPLS/TE Local Interface Index", "ospf.mpls.local_id", FT_UINT32,
+       BASE_DEC, NULL, 0x0, "", HFILL }},
+    {&ospf_filter[OSPFF_LS_MPLS_REMOTE_IFID],
+     { "MPLS/TE Remote Interface Index", "ospf.mpls.remote_id", FT_UINT32,
+       BASE_DEC, NULL, 0x0, "", HFILL }},
+
+
+
+};
+
+static guint8 ospf_msg_type_to_filter (guint8 msg_type)
+{
+    if (msg_type >= OSPF_HELLO &&
+       msg_type <= OSPF_LS_ACK)
+       return msg_type + OSPFF_MSG_MIN;
+    return -1;
+}
+
+static guint8 ospf_ls_type_to_filter (guint8 ls_type)
+{
+    if (ls_type >= OSPF_LSTYPE_ROUTER &&
+       ls_type <= OSPF_LSTYPE_EXTATTR)
+       return OSPFF_LS_MIN + ls_type;
+    else if (ls_type >= OSPF_LSTYPE_OP_LINKLOCAL &&
+            ls_type <= OSPF_LSTYPE_OP_ASWIDE)
+       return OSPFF_LS_OPAQUE;
+    else
+       return -1;
+}
+
 static dissector_handle_t data_handle;
 
 static void dissect_ospf_hello(tvbuff_t*, int, proto_tree*, guint8);
-static void dissect_ospf_db_desc(tvbuff_t*, int, proto_tree*, guint8); 
-static void dissect_ospf_ls_req(tvbuff_t*, int, proto_tree*, guint8); 
-static void dissect_ospf_ls_upd(tvbuff_t*, int, proto_tree*, guint8); 
-static void dissect_ospf_ls_ack(tvbuff_t*, int, proto_tree*, guint8); 
+static void dissect_ospf_db_desc(tvbuff_t*, int, proto_tree*, guint8);
+static void dissect_ospf_ls_req(tvbuff_t*, int, proto_tree*, guint8);
+static void dissect_ospf_ls_upd(tvbuff_t*, int, proto_tree*, guint8);
+static void dissect_ospf_ls_ack(tvbuff_t*, int, proto_tree*, guint8);
 
 /* dissect_ospf_v[23]lsa returns the offset of the next LSA
- * if disassemble_body is set to FALSE (e.g. in LSA ACK 
+ * if disassemble_body is set to FALSE (e.g. in LSA ACK
  * packets), the offset is set to the offset of the next
  * LSA header
  */
-static int dissect_ospf_v2_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body); 
-static int dissect_ospf_v3_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body); 
+static int dissect_ospf_v2_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body);
+static int dissect_ospf_v3_lsa(tvbuff_t*, int, proto_tree*, gboolean disassemble_body);
 
 static void dissect_ospf_options(tvbuff_t *, int, proto_tree *, guint8);
 
@@ -228,11 +400,11 @@ static void dissect_ospf_v3_prefix_options(tvbuff_t *, int, proto_tree *);
 
 static void dissect_ospf_v3_address_prefix(tvbuff_t *, int, int, proto_tree *);
 
-static void 
+static void
 dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     proto_tree *ospf_tree = NULL;
-    proto_item *ti; 
+    proto_item *ti;
     proto_tree *ospf_header_tree;
     guint8  version;
     guint8  packet_type;
@@ -243,7 +415,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     guint16 cksum, computed_cksum;
     guint length, reported_length;
     guint16 auth_type;
-    char auth_data[8];
+    char auth_data[8+1];
     int crypto_len;
     unsigned int ospf_header_length;
     guint8 instance_ID;
@@ -273,7 +445,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     if (check_col(pinfo->cinfo, COL_INFO)) {
        col_add_str(pinfo->cinfo, COL_INFO,
                    val_to_str(packet_type, pt_vals, "Unknown (%u)"));
-    }  
+    }
 
     if (tree) {
        ospflen = tvb_get_ntohs(tvb, 2);
@@ -282,18 +454,20 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
        ospf_tree = proto_item_add_subtree(ti, ett_ospf);
 
        ti = proto_tree_add_text(ospf_tree, tvb, 0, ospf_header_length,
-                                "OSPF Header"); 
+                                "OSPF Header");
        ospf_header_tree = proto_item_add_subtree(ti, ett_ospf_hdr);
 
         proto_tree_add_text(ospf_header_tree, tvb, 0, 1, "OSPF Version: %u",
-                           version);  
-       proto_tree_add_text(ospf_header_tree, tvb, 1, 1, "OSPF Packet Type: %u (%s)",
-                           packet_type,
-                           val_to_str(packet_type, pt_vals, "Unknown"));
+                           version);
+       proto_tree_add_item(ospf_header_tree, ospf_filter[OSPFF_MSG_TYPE],
+                           tvb, 1, 1, FALSE);
+       proto_tree_add_item_hidden(ospf_header_tree,
+                                  ospf_filter[ospf_msg_type_to_filter(packet_type)],
+                                  tvb, 1, 1, FALSE);
        proto_tree_add_text(ospf_header_tree, tvb, 2, 2, "Packet Length: %u",
                            ospflen);
-       proto_tree_add_text(ospf_header_tree, tvb, 4, 4, "Source OSPF Router ID: %s",
-                           ip_to_str(tvb_get_ptr(tvb, 4, 4)));
+       proto_tree_add_item(ospf_header_tree, ospf_filter[OSPFF_SRC_ROUTER],
+                           tvb, 4, 4, FALSE);
        areaid=tvb_get_ntohl(tvb,8);
        proto_tree_add_text(ospf_header_tree, tvb, 8, 4, "Area ID: %s%s",
                               ip_to_str(tvb_get_ptr(tvb, 8, 4)), areaid == 0 ? " (Backbone)" : "");
@@ -342,8 +516,8 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                cksum_vec[1].ptr = pinfo->dst.data;
                cksum_vec[1].len = pinfo->dst.len;
                cksum_vec[2].ptr = (const guint8 *)&phdr;
-               phdr[0] = htonl(ospflen);
-               phdr[1] = htonl(IP_PROTO_OSPF);
+               phdr[0] = g_htonl(ospflen);
+               phdr[1] = g_htonl(IP_PROTO_OSPF);
                cksum_vec[2].len = 8;
 
                cksum_vec[3].ptr = tvb_get_ptr(tvb, 0, reported_length);
@@ -371,7 +545,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
 
        /* Authentication is only valid for OSPFv2 */
-        if ( version == OSPF_VERSION_2 ) {        
+        if ( version == OSPF_VERSION_2 ) {
             auth_type = tvb_get_ntohs(tvb, 14);
            proto_tree_add_text(ospf_header_tree, tvb, 14, 2, "Auth Type: %s",
                            val_to_str(auth_type, auth_vals, "Unknown (%u)"));
@@ -382,7 +556,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                break;
 
             case OSPF_AUTH_SIMPLE:
-               tvb_get_nstringz0(tvb, 16, 8, auth_data);
+               tvb_get_nstringz0(tvb, 16, 8+1, auth_data);
                proto_tree_add_text(ospf_header_tree, tvb, 16, 8, "Auth Data: %s", auth_data);
                break;
 
@@ -394,7 +568,7 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                                crypto_len);
                proto_tree_add_text(ospf_header_tree, tvb, 20, 4, "Auth Crypto Sequence Number: 0x%x",
                                tvb_get_ntohl(tvb, 20));
-  
+
                /* Show the message digest that was appended to the end of the
                   OSPF message - but only if it's present (we don't want
                   to get an exception before we've tried dissecting OSPF
@@ -453,7 +627,8 @@ dissect_ospf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
            break;
 
        default:
-           call_dissector(data_handle,tvb_new_subset(tvb, ospf_header_length,-1,tvb_reported_length_remaining(tvb,ospf_header_length)), pinfo, tree);
+           call_dissector(data_handle,
+               tvb_new_subset(tvb, ospf_header_length, -1, -1), pinfo, tree);
            break;
        }
     }
@@ -463,11 +638,11 @@ static void
 dissect_ospf_hello(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
 {
     proto_tree *ospf_hello_tree;
-    proto_item *ti; 
+    proto_item *ti;
 
     ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF Hello Packet");
     ospf_hello_tree = proto_item_add_subtree(ti, ett_ospf_hello);
-    
+
     switch (version ) {
         case OSPF_VERSION_2:
             proto_tree_add_text(ospf_hello_tree, tvb, offset, 4, "Network Mask: %s",
@@ -519,7 +694,7 @@ dissect_ospf_hello(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
 
            break;
 
-        default:    
+        default:
             break;
     }
 }
@@ -528,17 +703,17 @@ static void
 dissect_ospf_db_desc(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
 {
     proto_tree *ospf_db_desc_tree=NULL;
-    proto_item *ti; 
+    proto_item *ti;
     guint8 flags;
     guint8 reserved;
     char flags_string[20] = "";
 
     if (tree) {
-       ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF DB Description"); 
+       ti = proto_tree_add_text(tree, tvb, offset, -1, "OSPF DB Description");
        ospf_db_desc_tree = proto_item_add_subtree(ti, ett_ospf_desc);
 
         switch (version ) {
+
            case OSPF_VERSION_2:
 
                 proto_tree_add_text(ospf_db_desc_tree, tvb, offset, 2, "Interface MTU: %u",
@@ -633,23 +808,20 @@ dissect_ospf_ls_req(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
     /* we place every request for a LSA in a single subtree */
     while (tvb_reported_length_remaining(tvb, offset) != 0) {
        ti = proto_tree_add_text(tree, tvb, offset, OSPF_LS_REQ_LENGTH,
-                                "Link State Request"); 
+                                "Link State Request");
        ospf_lsr_tree = proto_item_add_subtree(ti, ett_ospf_lsr);
-      
-        reserved = tvb_get_guint8(tvb, offset);
-        proto_tree_add_text(ospf_lsr_tree, tvb, offset, 1,
-           (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
-                               reserved);
 
         switch ( version ) {
 
            case OSPF_VERSION_2:
                ls_type = tvb_get_ntohl(tvb, offset);
-               proto_tree_add_text(ospf_lsr_tree, tvb, offset, 4, "LS Type: %s (%u)",
-                           val_to_str(ls_type, ls_type_vals, "Unknown"),
-                           ls_type);
+               proto_tree_add_item(ospf_lsr_tree, ospf_filter[OSPFF_LS_TYPE],
+                                   tvb, offset, 4, FALSE);
                break;
            case OSPF_VERSION_3:
+               reserved = tvb_get_ntohs(tvb, offset);
+               proto_tree_add_text(ospf_lsr_tree, tvb, offset, 2,
+                   (reserved == 0 ? "Reserved: %u" :  "Reserved: %u (incorrect, should be 0)"), reserved);
                ls_type = tvb_get_ntohs(tvb, offset+2);
                proto_tree_add_text(ospf_lsr_tree, tvb, offset+2, 2, "LS Type: %s (0x%04x)",
                            val_to_str(ls_type, v3_ls_type_vals, "Unknown"),
@@ -661,10 +833,10 @@ dissect_ospf_ls_req(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
         }
 
 
-       proto_tree_add_text(ospf_lsr_tree, tvb, offset + 4, 4, "Link State ID: %s", 
+       proto_tree_add_text(ospf_lsr_tree, tvb, offset + 4, 4, "Link State ID: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
-       proto_tree_add_text(ospf_lsr_tree, tvb, offset + 8, 4, "Advertising Router: %s", 
-                           ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
+       proto_tree_add_item(ospf_lsr_tree, ospf_filter[OSPFF_ADV_ROUTER],
+                           tvb, offset + 8, 4, FALSE);
 
        offset += 12;
     }
@@ -676,7 +848,7 @@ dissect_ospf_ls_upd(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
     proto_tree *ospf_lsa_upd_tree=NULL;
     proto_item *ti;
     guint32 lsa_nr;
-    guint32 lsa_counter; 
+    guint32 lsa_counter;
 
     ti = proto_tree_add_text(tree, tvb, offset, -1, "LS Update Packet");
     ospf_lsa_upd_tree = proto_item_add_subtree(ti, ett_ospf_lsa_upd);
@@ -686,7 +858,7 @@ dissect_ospf_ls_upd(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
                        lsa_nr);
     /* skip to the beginning of the first LSA */
     offset += 4; /* the LS Upd Packet contains only a 32 bit #LSAs field */
-    
+
     lsa_counter = 0;
     while (lsa_counter < lsa_nr) {
         if ( version == OSPF_VERSION_2)
@@ -712,7 +884,7 @@ dissect_ospf_ls_ack(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version)
 }
 
 /*
- * Returns if an LSA is opaque, i.e. requires special treatment 
+ * Returns if an LSA is opaque, i.e. requires special treatment
  */
 static int
 is_opaque(int lsa_type)
@@ -762,19 +934,13 @@ static const value_string mpls_link_stlv_str[] = {
 };
 
 /*
- * From packet-rsvp.c
- */
-extern const value_string gmpls_lsp_enc_str[];
-extern const value_string gmpls_switching_type_str[];
-
-/* 
- * Dissect MPLS/TE opaque LSA 
+ * Dissect MPLS/TE opaque LSA
  */
 static void
 dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                      guint32 length)
 {
-    proto_item *ti; 
+    proto_item *ti;
     proto_tree *mpls_tree;
     proto_tree *tlv_tree;
     proto_tree *stlv_tree;
@@ -789,6 +955,8 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
 
     ti = proto_tree_add_text(tree, tvb, offset, length,
                             "MPLS Traffic Engineering LSA");
+    proto_tree_add_item_hidden(tree, ospf_filter[OSPFF_LS_MPLS],
+                              tvb, offset, 2, FALSE);
     mpls_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls);
 
     while (length != 0) {
@@ -800,14 +968,14 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
 
        case MPLS_TLV_ROUTER:
            ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
-                                    "Router Address: %s", 
+                                    "Router Address: %s",
                                     ip_to_str(tvb_get_ptr(tvb, offset+4, 4)));
            tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_router);
            proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: 1 - Router Address");
            proto_tree_add_text(tlv_tree, tvb, offset+2, 2, "TLV Length: %u",
                                tlv_length);
-           proto_tree_add_text(tlv_tree, tvb, offset+4, 4, "Router Address: %s",
-                               ip_to_str(tvb_get_ptr(tvb, offset+4, 4)));
+           proto_tree_add_item(tlv_tree, ospf_filter[OSPFF_LS_MPLS_ROUTERID],
+                               tvb, offset+4, 4, FALSE);
            break;
 
        case MPLS_TLV_LINK:
@@ -849,9 +1017,8 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                                        "TLV Type: %u: %s", stlv_type, stlv_name);
                    proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
                                        stlv_len);
-                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %s (%x)", stlv_name,
-                                       ip_to_str(tvb_get_ptr(tvb, stlv_offset + 4, 4)),
-                                       tvb_get_ntohl(tvb, stlv_offset + 4));
+                   proto_tree_add_item(stlv_tree, ospf_filter[OSPFF_LS_MPLS_LINKID],
+                                       tvb, stlv_offset+4, 4, FALSE);
                    break;
 
                case MPLS_LINK_LOCAL_IF:
@@ -866,8 +1033,11 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                    /*   The Local/Remote Interface IP Address sub-TLV is TLV type 3/4, and is 4N
                       octets in length, where N is the number of neighbor addresses. */
                    for (i=0; i < stlv_len; i+=4)
-                     proto_tree_add_text(stlv_tree, tvb, stlv_offset+4+i, 4, "%s: %s", stlv_name,
-                                         ip_to_str(tvb_get_ptr(tvb, stlv_offset+4+i, 4)));
+                     proto_tree_add_item(stlv_tree,
+                                         stlv_type==MPLS_LINK_LOCAL_IF ?
+                                         ospf_filter[OSPFF_LS_MPLS_LOCAL_ADDR] :
+                                         ospf_filter[OSPFF_LS_MPLS_REMOTE_ADDR],
+                                         tvb, stlv_offset+4+i, 4, FALSE);
                    break;
 
                case MPLS_LINK_TE_METRIC:
@@ -887,15 +1057,15 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                case MPLS_LINK_MAX_BW:
                case MPLS_LINK_MAX_RES_BW:
                    ti = proto_tree_add_text(tlv_tree, tvb, stlv_offset, stlv_len+4,
-                                            "%s: %ld", stlv_name,
-                                            tvb_ieee_to_long(tvb, stlv_offset + 4));
+                                            "%s: %.10g", stlv_name,
+                                            tvb_get_ntohieee_float(tvb, stlv_offset + 4));
                    stlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link_stlv);
                    proto_tree_add_text(stlv_tree, tvb, stlv_offset, 2,
                                        "TLV Type: %u: %s", stlv_type, stlv_name);
                    proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
                                        stlv_len);
-                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %ld", stlv_name,
-                                       tvb_ieee_to_long(tvb, stlv_offset + 4));
+                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %.10g", stlv_name,
+                                       tvb_get_ntohieee_float(tvb, stlv_offset + 4));
                    break;
 
                case MPLS_LINK_UNRES_BW:
@@ -908,9 +1078,9 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                                        stlv_len);
                    for (i = 0; i < 8; i++) {
                        proto_tree_add_text(stlv_tree, tvb, stlv_offset+4+(i*4), 4,
-                                           "Pri %d: %ld bytes/s (%.0f bits/s)", i,
-                                           tvb_ieee_to_long(tvb, stlv_offset + 4 + i*4),
-                                           tvb_ieee_to_long(tvb, stlv_offset + 4 + i*4) * 8.0);
+                                           "Pri %d: %.10g bytes/s (%.0f bits/s)", i,
+                                           tvb_get_ntohieee_float(tvb, stlv_offset + 4 + i*4),
+                                           tvb_get_ntohieee_float(tvb, stlv_offset + 4 + i*4) * 8.0);
                    }
                    break;
 
@@ -925,9 +1095,11 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                                        "TLV Type: %u: %s", stlv_type, stlv_name);
                    proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
                                        stlv_len);
-                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 4, "%s: %d (0x%x)", stlv_name,
-                                       tvb_get_ntohl(tvb, stlv_offset + 4),
-                                       tvb_get_ntohl(tvb, stlv_offset + 4));
+                   proto_tree_add_item(stlv_tree,
+                                       stlv_type==MPLS_LINK_LOCAL_ID ?
+                                       ospf_filter[OSPFF_LS_MPLS_LOCAL_IFID] :
+                                       ospf_filter[OSPFF_LS_MPLS_REMOTE_IFID],
+                                       tvb, stlv_offset+4, 4, FALSE);
                    break;
 
                case MPLS_LINK_IF_SWITCHING_DESC:
@@ -938,17 +1110,17 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
                                        "TLV Type: %u: %s", stlv_type, stlv_name);
                    proto_tree_add_text(stlv_tree, tvb, stlv_offset+2, 2, "TLV Length: %u",
                                        stlv_len);
-                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 1, "Switching Type: %s", 
-                                       val_to_str(tvb_get_guint8(tvb,stlv_offset+4), 
+                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+4, 1, "Switching Type: %s",
+                                       val_to_str(tvb_get_guint8(tvb,stlv_offset+4),
                                                   gmpls_switching_type_str, "Unknown (%d)"));
-                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+5, 1, "Encoding: %s", 
-                                       val_to_str(tvb_get_guint8(tvb,stlv_offset+5), 
+                   proto_tree_add_text(stlv_tree, tvb, stlv_offset+5, 1, "Encoding: %s",
+                                       val_to_str(tvb_get_guint8(tvb,stlv_offset+5),
                                                   gmpls_lsp_enc_str, "Unknown (%d)"));
                    for (i = 0; i < 8; i++) {
                        proto_tree_add_text(stlv_tree, tvb, stlv_offset+8+(i*4), 4,
-                                           "Pri %d: %ld bytes/s (%.0f bits/s)", i,
-                                           tvb_ieee_to_long(tvb, stlv_offset + 8 + i*4),
-                                           tvb_ieee_to_long(tvb, stlv_offset + 8 + i*4) * 8.0);
+                                           "Pri %d: %.10g bytes/s (%.0f bits/s)", i,
+                                           tvb_get_ntohieee_float(tvb, stlv_offset + 8 + i*4),
+                                           tvb_get_ntohieee_float(tvb, stlv_offset + 8 + i*4) * 8.0);
                    }
                    break;
 
@@ -962,7 +1134,7 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
            break;
 
        default:
-           ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4, 
+           ti = proto_tree_add_text(mpls_tree, tvb, offset, tlv_length+4,
                                     "Unknown LSA: %u", tlv_type);
            tlv_tree = proto_item_add_subtree(ti, ett_ospf_lsa_mpls_link);
            proto_tree_add_text(tlv_tree, tvb, offset, 2, "TLV Type: %u - Unknown",
@@ -981,7 +1153,7 @@ dissect_ospf_lsa_mpls(tvbuff_t *tvb, int offset, proto_tree *tree,
 /*
  * Dissect opaque LSAs
  */
-void
+static void
 dissect_ospf_lsa_opaque(tvbuff_t *tvb, int offset, proto_tree *tree,
                        guint8 ls_id_type, guint32 length)
 {
@@ -1003,7 +1175,7 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
                 gboolean disassemble_body)
 {
     proto_tree *ospf_lsa_tree;
-    proto_item *ti; 
+    proto_item *ti;
 
     guint8              ls_type;
     guint16             ls_length;
@@ -1016,6 +1188,7 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
     guint16             link_counter;
     guint8              tos_counter;
     char               *link_type_str;
+    char               *link_type_short_str;
     char               *link_id;
 
     /* AS-external LSA */
@@ -1030,34 +1203,51 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
     if (disassemble_body) {
        ti = proto_tree_add_text(tree, tvb, offset, ls_length,
-                                "%s (Type: %u)", val_to_str(ls_type, ls_type_vals,"Unkown"), ls_type); 
+                                "LS Type: %s",
+                                val_to_str(ls_type, ls_type_vals, "Unknown (%d)"));
     } else {
        ti = proto_tree_add_text(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
-                                "LSA Header"); 
+                                "LSA Header");
     }
     ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
 
     proto_tree_add_text(ospf_lsa_tree, tvb, offset, 2, "LS Age: %u seconds",
                        tvb_get_ntohs(tvb, offset));
     dissect_ospf_options(tvb, offset + 2, ospf_lsa_tree, OSPF_VERSION_2);
-    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 3, 1, "LSA Type: %u (%s)",
-                       ls_type, val_to_str(ls_type,ls_type_vals,"Unknown"));
+    proto_tree_add_item(ospf_lsa_tree, ospf_filter[OSPFF_LS_TYPE], tvb,
+                       offset + 3, 1, FALSE);
+    proto_tree_add_item_hidden(ospf_lsa_tree,
+                              ospf_filter[ospf_ls_type_to_filter(ls_type)], tvb,
+                              offset + 3, 1, FALSE);
 
     if (is_opaque(ls_type)) {
        ls_id_type = tvb_get_guint8(tvb, offset + 4);
-       proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 1, "Link State ID Opaque Type: %u",
-                           ls_id_type);
-       proto_tree_add_text(ospf_lsa_tree, tvb, offset + 5, 3, "Link State ID Opaque ID: %u",
-                           tvb_get_ntoh24(tvb, offset + 5));
+       proto_tree_add_uint(ospf_lsa_tree, ospf_filter[OSPFF_LS_OPAQUE_TYPE],
+                           tvb, offset + 4, 1, ls_id_type);
+
+       switch (ls_id_type) {
+
+       case OSPF_LSA_MPLS_TE:
+           proto_tree_add_text(ospf_lsa_tree, tvb, offset + 5, 1, "Link State ID TE-LSA Reserved: %u",
+                               tvb_get_guint8(tvb, offset + 5));
+           proto_tree_add_item(ospf_lsa_tree, ospf_filter[OSPFF_LS_MPLS_TE_INSTANCE],
+                               tvb, offset + 6, 2, FALSE);
+           break;
+
+       default:
+           proto_tree_add_text(ospf_lsa_tree, tvb, offset + 5, 3, "Link State ID Opaque ID: %u",
+                               tvb_get_ntoh24(tvb, offset + 5));
+           break;
+       }
     } else {
        ls_id_type = 0;
        proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link State ID: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
     }
 
-    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Advertising Router: %s",
-                       ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
-    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: 0x%04x",
+    proto_tree_add_item(ospf_lsa_tree, ospf_filter[OSPFF_ADV_ROUTER],
+                       tvb, offset + 8, 4, FALSE);
+    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: 0x%08x",
                        tvb_get_ntohl(tvb, offset + 12));
     proto_tree_add_text(ospf_lsa_tree, tvb, offset + 16, 2, "LS Checksum: %04x",
                        tvb_get_ntohs(tvb, offset + 16));
@@ -1067,6 +1257,8 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
     /* skip past the LSA header to the body */
     offset += OSPF_LSA_HEADER_LENGTH;
+    if (ls_length <= OSPF_LSA_HEADER_LENGTH)
+       return offset;  /* no data, or bogus length */
     ls_length -= OSPF_LSA_HEADER_LENGTH;
 
     if (!disassemble_body)
@@ -1082,64 +1274,84 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
        proto_tree_add_text(ospf_lsa_tree, tvb, offset + 2, 2, "Number of Links: %u",
                            nr_links);
        offset += 4;
-       /* nr_links links follow 
+       /* nr_links links follow
         * maybe we should put each of the links into its own subtree ???
         */
        for (link_counter = 1; link_counter <= nr_links; link_counter++) {
+            proto_tree *ospf_lsa_router_link_tree;
+            proto_item *ti_local;
+
+
            /* check the Link Type and ID */
            link_type = tvb_get_guint8(tvb, offset + 8);
            switch (link_type) {
 
            case OSPF_LINK_PTP:
                 link_type_str="Point-to-point connection to another router";
+                link_type_short_str="PTP";
                link_id="Neighboring router's Router ID";
                break;
 
            case OSPF_LINK_TRANSIT:
                link_type_str="Connection to a transit network";
+                link_type_short_str="Transit";
                link_id="IP address of Designated Router";
                break;
 
            case OSPF_LINK_STUB:
                link_type_str="Connection to a stub network";
+                link_type_short_str="Stub";
                link_id="IP network/subnet number";
                break;
 
            case OSPF_LINK_VIRTUAL:
                link_type_str="Virtual link";
+                link_type_short_str="Virtual";
                link_id="Neighboring router's Router ID";
                break;
 
            default:
                link_type_str="Unknown link type";
+                link_type_short_str="Unknown";
                link_id="Unknown link ID";
                break;
            }
 
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "%s: %s", link_id,
+           nr_tos = tvb_get_guint8(tvb, offset + 9);
+
+            
+            ti_local = proto_tree_add_text(ospf_lsa_tree, tvb, offset, 12 + 4 * nr_tos,
+                                     "Type: %-8s ID: %-15s Data: %-15s Metric: %d",
+                                     link_type_short_str, 
+                                     ip_to_str(tvb_get_ptr(tvb, offset, 4)),
+                                     ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)),
+                                     tvb_get_ntohs(tvb, offset + 10));
+
+            ospf_lsa_router_link_tree = proto_item_add_subtree(ti_local, ett_ospf_lsa_router_link);
+
+           proto_tree_add_text(ospf_lsa_router_link_tree, tvb, offset, 4, "%s: %s", link_id,
                                ip_to_str(tvb_get_ptr(tvb, offset, 4)));
 
            /* link_data should be specified in detail (e.g. network mask) (depends on link type)*/
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link Data: %s",
+           proto_tree_add_text(ospf_lsa_router_link_tree, tvb, offset + 4, 4, "Link Data: %s",
                                ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
 
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 1, "Link Type: %u - %s",
+           proto_tree_add_text(ospf_lsa_router_link_tree, tvb, offset + 8, 1, "Link Type: %u - %s",
                                link_type, link_type_str);
-           nr_tos = tvb_get_guint8(tvb, offset + 9);
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset + 9, 1, "Number of TOS metrics: %u",
+           proto_tree_add_text(ospf_lsa_router_link_tree, tvb, offset + 9, 1, "Number of TOS metrics: %u",
                                nr_tos);
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset + 10, 2, "TOS 0 metric: %u",
+           proto_tree_add_text(ospf_lsa_router_link_tree, tvb, offset + 10, 2, "TOS 0 metric: %u",
                                tvb_get_ntohs(tvb, offset + 10));
 
            offset += 12;
 
-           /* nr_tos metrics may follow each link 
+           /* nr_tos metrics may follow each link
             * ATTENTION: TOS metrics are not tested (I don't have TOS
             * based routing)
             * please send me a mail if it is/isn't working
             */
            for (tos_counter = 1; tos_counter <= nr_tos; tos_counter++) {
-               proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
+               proto_tree_add_text(ospf_lsa_router_link_tree, tvb, offset, 4, "TOS: %u, Metric: %u",
                                    tvb_get_guint8(tvb, offset),
                                    tvb_get_ntohs(tvb, offset + 2));
                offset += 4;
@@ -1181,7 +1393,7 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
     case OSPF_LSTYPE_ASEXT:
     case OSPF_LSTYPE_ASEXT7:
-       proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s", 
+       proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Netmask: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset, 4)));
        offset += 4;
 
@@ -1198,7 +1410,7 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
                            tvb_get_ntoh24(tvb, offset + 1));
        offset += 4;
 
-       proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s", 
+       proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset, 4)));
        offset += 4;
 
@@ -1221,7 +1433,7 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
                                tvb_get_ntoh24(tvb, offset + 1));
            offset += 4;
 
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s", 
+           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Forwarding Address: %s",
                                ip_to_str(tvb_get_ptr(tvb, offset, 4)));
            offset += 4;
 
@@ -1234,6 +1446,9 @@ dissect_ospf_v2_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
     case OSPF_LSTYPE_OP_LINKLOCAL:
     case OSPF_LSTYPE_OP_AREALOCAL:
     case OSPF_LSTYPE_OP_ASWIDE:
+       /*
+        * RFC 2370 opaque LSAs.
+        */
        dissect_ospf_lsa_opaque(tvb, offset, ospf_lsa_tree, ls_id_type,
                                ls_length);
        offset += ls_length;
@@ -1255,7 +1470,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
                 gboolean disassemble_body)
 {
     proto_tree *ospf_lsa_tree;
-    proto_item *ti; 
+    proto_item *ti;
 
     guint16             ls_type;
     guint16             ls_length;
@@ -1288,10 +1503,10 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
     if (disassemble_body) {
        ti = proto_tree_add_text(tree, tvb, offset, ls_length,
-                                "%s (Type: 0x%04x)", val_to_str(ls_type, v3_ls_type_vals,"Unknown"), ls_type); 
+                                "%s (Type: 0x%04x)", val_to_str(ls_type, v3_ls_type_vals,"Unknown"), ls_type);
     } else {
        ti = proto_tree_add_text(tree, tvb, offset, OSPF_LSA_HEADER_LENGTH,
-                                "LSA Header"); 
+                                "LSA Header");
     }
     ospf_lsa_tree = proto_item_add_subtree(ti, ett_ospf_lsa);
 
@@ -1304,9 +1519,9 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
     proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Link State ID: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
 
-    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Advertising Router: %s",
-                       ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
-    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: %d",
+    proto_tree_add_item(ospf_lsa_tree, ospf_filter[OSPFF_ADV_ROUTER],
+                       tvb, offset + 8, 4, FALSE);
+    proto_tree_add_text(ospf_lsa_tree, tvb, offset + 12, 4, "LS Sequence Number: 0x%08x",
                        tvb_get_ntohl(tvb, offset + 12));
     proto_tree_add_text(ospf_lsa_tree, tvb, offset + 16, 2, "LS Checksum: %04x",
                        tvb_get_ntohs(tvb, offset + 16));
@@ -1359,7 +1574,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
         if (ls_length > 0)
             proto_tree_add_text(ospf_lsa_tree, tvb, offset, ls_length,
-                  "Router Interfaces:"); 
+                  "Router Interfaces:");
 
         /* scan all router-lsa router interfaces */
        /* maybe we should put each of the links into its own subtree ??? */
@@ -1523,7 +1738,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
        proto_tree_add_text(ospf_lsa_tree, tvb, offset, 1, "Flags: 0x%02x (%s)",
                            flags, flags_string);
-        
+
        /* 24 bits metric */
        metric=tvb_get_ntoh24(tvb, offset+1);
        proto_tree_add_text(ospf_lsa_tree, tvb, offset+1, 3,
@@ -1545,13 +1760,13 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
         /* address_prefix */
         dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
-       
+
         offset+=(prefix_length+31)/32*4;
 
         /* Forwarding Address (optional - only if F-flag is on) */
         if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_F) ) {
            proto_tree_add_text(ospf_lsa_tree, tvb, offset, 16,"Forwarding Address: %s",
-              ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset, 16)));
+              ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset, 16)));
 
            offset+=16;
         }
@@ -1559,7 +1774,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
         /* External Route Tag (optional - only if T-flag is on) */
         if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_T) ) {
            external_route_tag=tvb_get_ntohl(tvb, offset);
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4,"External Route Tag: 0x%04x",
+           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4,"External Route Tag: %u",
                                external_route_tag);
 
            offset+=4;
@@ -1567,7 +1782,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
         /* Referenced Link State ID (optional - only if Referenced LS type is non-zero */
         if ( (offset < end_offset) && (referenced_ls_type != 0) ) {
-           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Referenced Link State ID: %s", 
+           proto_tree_add_text(ospf_lsa_tree, tvb, offset, 4, "Referenced Link State ID: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset, 4)));
            offset+=4;
         }
@@ -1585,7 +1800,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
         /* Link-local Interface Address */
         proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 16, "Link-local Interface Address: %s",
-           ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, 16)));
+           ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, 16)));
 
         /* Number prefixes */
         number_prefixes=tvb_get_ntohl(tvb, offset + 20);
@@ -1611,12 +1826,12 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
             /* address_prefix */
             dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
-       
+
             offset+=(prefix_length+31)/32*4;
 
             number_prefixes--;
 
-        }             
+        }
         break;
 
     case OSPF_V3_LSTYPE_INTRA_AREA_PREFIX:
@@ -1631,11 +1846,11 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
                            referenced_ls_type, val_to_str(referenced_ls_type, v3_ls_type_vals, "Unknown"));
 
         /* Referenced Link State ID */
-       proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Referenced Link State ID: %s", 
+       proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 4, "Referenced Link State ID: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset + 4, 4)));
 
         /* Referenced Advertising Router */
-       proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Referenced Advertising Router: %s", 
+       proto_tree_add_text(ospf_lsa_tree, tvb, offset + 8, 4, "Referenced Advertising Router: %s",
                            ip_to_str(tvb_get_ptr(tvb, offset + 8, 4)));
 
         offset+=12;
@@ -1658,7 +1873,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree,
 
             /* address_prefix */
             dissect_ospf_v3_address_prefix(tvb, offset, prefix_length, ospf_lsa_tree);
-       
+
             offset+=(prefix_length+31)/32*4;
 
             number_prefixes--;
@@ -1728,7 +1943,7 @@ dissect_ospf_options(tvbuff_t *tvb, int offset, proto_tree *tree, guint8 version
             if (options_ospfv2 & OSPF_V2_OPTIONS_DN) {
                if (options_string[0] != '\0')
                    strcat(options_string, "/");
-               strcat(options_string, "DN");  
+               strcat(options_string, "DN");
             }
 
             proto_tree_add_text(tree, tvb, offset, 1, "Options: 0x%x (%s)",
@@ -1791,7 +2006,7 @@ static void dissect_ospf_v3_prefix_options(tvbuff_t *tvb, int offset, proto_tree
     guint8 position;
 
     position=0;
-    
+
     prefix_options=tvb_get_guint8(tvb, offset);
 
     strcpy(prefix_options_string,"");
@@ -1858,15 +2073,15 @@ static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, int offset, int prefix
            buffer[bufpos++]=':';
 
         sprintf(bytebuf,"%02x",value);
-        buffer[bufpos++]=bytebuf[0];        
-        buffer[bufpos++]=bytebuf[1];        
-        
+        buffer[bufpos++]=bytebuf[0];
+        buffer[bufpos++]=bytebuf[1];
+
        position++;
        offset++;
         bytes_to_process--;
     }
 
-    buffer[bufpos]=0;  
+    buffer[bufpos]=0;
     proto_tree_add_text(tree, tvb, start_offset, ((prefix_length+31)/32)*4, "Address Prefix: %s",buffer);
 
 }
@@ -1875,10 +2090,6 @@ static void dissect_ospf_v3_address_prefix(tvbuff_t *tvb, int offset, int prefix
 void
 proto_register_ospf(void)
 {
-/*        static hf_register_info hf[] = {
-                { &variable,
-                { "Name",           "ospf.abbreviation", TYPE, VALS_POINTER }},
-        };*/
     static gint *ett[] = {
        &ett_ospf,
        &ett_ospf_hdr,
@@ -1886,6 +2097,7 @@ proto_register_ospf(void)
        &ett_ospf_desc,
        &ett_ospf_lsr,
        &ett_ospf_lsa,
+        &ett_ospf_lsa_router_link,
        &ett_ospf_lsa_upd,
        &ett_ospf_lsa_mpls,
        &ett_ospf_lsa_mpls_router,
@@ -1895,7 +2107,7 @@ proto_register_ospf(void)
 
     proto_ospf = proto_register_protocol("Open Shortest Path First",
                                         "OSPF", "ospf");
- /*       proto_register_field_array(proto_ospf, hf, array_length(hf));*/
+    proto_register_field_array(proto_ospf, ospff_info, array_length(ospff_info));
     proto_register_subtree_array(ett, array_length(ett));
 }