M2TP support, from Heinz Prantner.
[obnox/wireshark/wip.git] / packet-isis-hello.c
index 9f5c96e139badc8e55bac9dbfff492be141db424..1f42efa3c921452459c0e68db007f87a29c313f0 100644 (file)
@@ -1,13 +1,12 @@
 /* packet-isis-hello.c
  * Routines for decoding isis hello packets and their CLVs
  *
- * $Id: packet-isis-hello.c,v 1.8 2000/05/31 05:07:12 guy Exp $
+ * $Id: packet-isis-hello.c,v 1.22 2001/11/26 04:52:50 hagbard Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * 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
@@ -53,6 +52,9 @@ static int hf_isis_hello_priority_reserved   = -1;
 static int hf_isis_hello_lan_id              = -1;
 static int hf_isis_hello_local_circuit_id    = -1;
 static int hf_isis_hello_clv_ipv4_int_addr   = -1;
+static int hf_isis_hello_clv_ipv6_int_addr   = -1;
+static int hf_isis_hello_clv_ptp_adj         = -1;
+static int hf_isis_hello_clv_mt              = -1;
 
 static gint ett_isis_hello                   = -1;
 static gint ett_isis_hello_clv_area_addr     = -1;
@@ -62,6 +64,11 @@ static gint ett_isis_hello_clv_unknown       = -1;
 static gint ett_isis_hello_clv_nlpid         = -1;
 static gint ett_isis_hello_clv_auth          = -1;
 static gint ett_isis_hello_clv_ipv4_int_addr = -1;
+static gint ett_isis_hello_clv_ipv6_int_addr = -1;
+static gint ett_isis_hello_clv_ptp_adj       = -1;
+static gint ett_isis_hello_clv_mt            = -1;
+
+static dissector_handle_t data_handle;
 
 static const value_string isis_hello_circuit_type_vals[] = {
        { ISIS_HELLO_TYPE_RESERVED,     "Reserved 0 (discard PDU)"},
@@ -73,18 +80,34 @@ static const value_string isis_hello_circuit_type_vals[] = {
 /* 
  * Predclare dissectors for use in clv dissection.
  */
-static void dissect_hello_area_address_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_is_neighbors_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_padding_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_nlpid_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_ip_int_addr_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_auth_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree);
+static void dissect_hello_padding_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_is_neighbors_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_ptp_adj_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_area_address_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_auth_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_mt_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+static void dissect_hello_nlpid_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length);
+
 
 static const isis_clv_handle_t clv_l1_hello_opts[] = {
        {
@@ -107,7 +130,7 @@ static const isis_clv_handle_t clv_l1_hello_opts[] = {
        },
        {
                ISIS_CLV_L1H_NLPID,
-               "NLPID",
+               "Protocols Supported",
                &ett_isis_hello_clv_nlpid,
                dissect_hello_nlpid_clv
        },
@@ -117,6 +140,12 @@ static const isis_clv_handle_t clv_l1_hello_opts[] = {
                &ett_isis_hello_clv_ipv4_int_addr,
                dissect_hello_ip_int_addr_clv
        },
+       {
+               ISIS_CLV_L1H_IPv6_INTERFACE_ADDR,
+               "IPv6 Interface address(es)",
+               &ett_isis_hello_clv_ipv6_int_addr,
+               dissect_hello_ipv6_int_addr_clv
+       },
        {
                ISIS_CLV_L1H_AUTHENTICATION_NS,
                "Authentication(non spec)",
@@ -129,6 +158,12 @@ static const isis_clv_handle_t clv_l1_hello_opts[] = {
                &ett_isis_hello_clv_auth,
                dissect_hello_auth_clv
        },
+       {
+               ISIS_CLV_L1H_MT,
+               "Multi Topology",
+               &ett_isis_hello_clv_mt,
+               dissect_hello_mt_clv
+       },
        {
                0,
                "",
@@ -158,7 +193,7 @@ static const isis_clv_handle_t clv_l2_hello_opts[] = {
        },
        {
                ISIS_CLV_L2H_NLPID,
-               "NLPID",
+               "Protocols Supported",
                &ett_isis_hello_clv_nlpid,
                dissect_hello_nlpid_clv
        },
@@ -168,6 +203,12 @@ static const isis_clv_handle_t clv_l2_hello_opts[] = {
                &ett_isis_hello_clv_ipv4_int_addr,
                dissect_hello_ip_int_addr_clv
        },
+       {
+               ISIS_CLV_L2H_IPv6_INTERFACE_ADDR,
+               "IPv6 Interface address(es)",
+               &ett_isis_hello_clv_ipv6_int_addr,
+               dissect_hello_ipv6_int_addr_clv
+       },
        {
                ISIS_CLV_L2H_AUTHENTICATION_NS,
                "Authentication(non spec)",
@@ -180,6 +221,12 @@ static const isis_clv_handle_t clv_l2_hello_opts[] = {
                &ett_isis_hello_clv_auth,
                dissect_hello_auth_clv
        },
+       {
+               ISIS_CLV_L2H_MT,
+               "Multi Topology",
+               &ett_isis_hello_clv_mt,
+               dissect_hello_mt_clv
+       },
        {
                0,
                "",
@@ -203,7 +250,7 @@ static const isis_clv_handle_t clv_ptp_hello_opts[] = {
        },
        {
                ISIS_CLV_PTP_NLPID,
-               "NLPID",
+               "Protocols Supported",
                &ett_isis_hello_clv_nlpid,
                dissect_hello_nlpid_clv
        },
@@ -213,6 +260,12 @@ static const isis_clv_handle_t clv_ptp_hello_opts[] = {
                &ett_isis_hello_clv_ipv4_int_addr,
                dissect_hello_ip_int_addr_clv
        },
+       {
+               ISIS_CLV_PTP_IPv6_INTERFACE_ADDR,
+               "IPv6 Interface address(es)",
+               &ett_isis_hello_clv_ipv6_int_addr,
+               dissect_hello_ipv6_int_addr_clv
+       },
        {
                ISIS_CLV_PTP_AUTHENTICATION_NS,
                "Authentication(non spec)",
@@ -225,6 +278,18 @@ static const isis_clv_handle_t clv_ptp_hello_opts[] = {
                &ett_isis_hello_clv_auth,
                dissect_hello_auth_clv
        },
+       {
+               ISIS_CLV_PTP_ADJ,
+               "point-to-point Adjacency State",
+               &ett_isis_hello_clv_ptp_adj,
+               dissect_hello_ptp_adj_clv
+       },
+       {
+               ISIS_CLV_PTP_MT,
+               "Multi Topology",
+               &ett_isis_hello_clv_mt,
+               dissect_hello_mt_clv
+       },
        {
                0,
                "",
@@ -241,19 +306,50 @@ static const isis_clv_handle_t clv_ptp_hello_opts[] = {
  *     clv common one.
  *
  * Input:
- *     u_char * : packet data
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
+ *     proto_tree * : proto tree to build on (may be null)
  *     int : current offset into packet data
- *     guint : length of this clv
- *     frame_data * : frame data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
+ *
+ * Output:
+ *     void, will modify proto_tree if not null.
+ */
+static void 
+dissect_hello_nlpid_clv(tvbuff_t *tvb, 
+       packet_info *pinfo, proto_tree *tree, int offset, 
+       int id_length, int length)
+{
+       isis_dissect_nlpid_clv(tvb, pinfo, tree, offset, length);
+}
+
+/*
+ * Name: dissect_hello_mt_clv()
+ *
+ * Description:
+ *     Decode for a hello packets Multi Topology clv.  Calls into the
+ *     clv common one.
+ *
+ * Input:
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : proto tree to build on (may be null)
+ *     int : current offset into packet data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
  *
  * Output:
  *     void, will modify proto_tree if not null.
  */
+
 static void 
-dissect_hello_nlpid_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree) {
-       isis_dissect_nlpid_clv(pd, offset, length, fd, tree );
+dissect_hello_mt_clv(tvbuff_t *tvb, 
+       packet_info *pinfo, proto_tree *tree, int offset, 
+       int id_length, int length)
+{
+       isis_dissect_mt_clv(tvb, pinfo, tree, offset, length,
+               hf_isis_hello_clv_mt );
 }
 
 /*
@@ -264,22 +360,52 @@ dissect_hello_nlpid_clv(const u_char *pd, int offset,
  *     clv common one.
  *
  * Input:
- *     u_char * : packet data
- *     int : current offset into packet data
- *     guint : length of this clv
- *     frame_data * : frame data
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : proto tree to build on (may be null)
+ *     int : current offset into packet data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
  *
  * Output:
  *     void, will modify proto_tree if not null.
  */
 static void 
-dissect_hello_ip_int_addr_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree) {
-       isis_dissect_ip_int_clv(pd, offset, length, fd, tree, 
+dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, 
+       packet_info *pinfo, proto_tree *tree, int offset, 
+       int id_length, int length)
+{
+       isis_dissect_ip_int_clv(tvb, pinfo, tree, offset, length,
                hf_isis_hello_clv_ipv4_int_addr );
 }
 
+/*
+ * Name: dissect_hello_ipv6_int_addr_clv()
+ *
+ * Description:
+ *     Decode for a hello packets ipv6 interface addr clv.  Calls into the
+ *     clv common one.
+ *
+ * Input:
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
+ *     proto_tree * : proto tree to build on (may be null)
+ *     int : current offset into packet data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
+ *
+ * Output:
+ *     void, will modify proto_tree if not null.
+ */
+static void 
+dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, 
+       packet_info *pinfo, proto_tree *tree, int offset, 
+       int id_length, int length)
+{
+       isis_dissect_ipv6_int_clv(tvb, pinfo, tree, offset, length,
+               hf_isis_hello_clv_ipv6_int_addr );
+}
+
 /*
  * Name: dissect_hello_auth_clv()
  *
@@ -289,20 +415,23 @@ dissect_hello_ip_int_addr_clv(const u_char *pd, int offset,
  *     password.
  *
  * Input:
- *     u_char * : packet data
- *     int : current offset into packet data
- *     guint : length of this clv
- *     frame_data * : frame data
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : proto tree to build on (may be null)
+ *     int : current offset into packet data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
  *
  * Output:
  *     void, will modify proto_tree if not null.
  */
 static void 
-dissect_hello_auth_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree) {
-       isis_dissect_authentication_clv(pd, offset, length, fd, tree, 
-               "Per Link authentication" );
+dissect_hello_auth_clv(tvbuff_t *tvb, 
+       packet_info *pinfo, proto_tree *tree, int offset, 
+       int id_length, int length)
+{
+       isis_dissect_authentication_clv(tvb, pinfo, tree, offset,
+               length, "authentication" );
 }
 
 /*
@@ -313,19 +442,81 @@ dissect_hello_auth_clv(const u_char *pd, int offset,
  *     clv common one.
  *
  * Input:
- *     u_char * : packet data
- *     int : current offset into packet data
- *     guint : length of this clv
- *     frame_data * : frame data
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : proto tree to build on (may be null)
+ *     int : current offset into packet data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
  *
  * Output:
  *     void, will modify proto_tree if not null.
  */
 static void 
-dissect_hello_area_address_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree) {
-       isis_dissect_area_address_clv(pd, offset, length, fd, tree );
+dissect_hello_area_address_clv(tvbuff_t *tvb, 
+       packet_info *pinfo, proto_tree *tree, int offset, 
+       int id_length, int length)
+{
+       isis_dissect_area_address_clv(tvb, pinfo, tree, offset, length);
+}
+
+
+
+static void 
+dissect_hello_ptp_adj_clv(tvbuff_t *tvb, 
+               packet_info *pinfo, proto_tree *tree, int offset, 
+               int id_length, int length)
+{
+        char adj_state[20];
+
+       switch(tvb_get_guint8(tvb, offset)) {
+         case 0:
+           strcpy(adj_state,"Up");
+           break;
+         case 1:
+           strcpy(adj_state,"Initializing");
+           break;
+         case 2:
+           strcpy(adj_state,"Down");
+           break;
+         default:
+           strcpy(adj_state,"<illegal value !!!>");
+           }
+
+       switch(length) {
+         case 1:
+           proto_tree_add_text ( tree, tvb, offset, 1,
+                                 "Adjacency State: %s", adj_state );
+           break;
+         case 5:
+           proto_tree_add_text ( tree, tvb, offset, 1,        
+                                  "Adjacency State: %s", adj_state ); 
+           proto_tree_add_text ( tree, tvb, offset+1, 4,        
+                                  "Extended Local circuit ID: 0x%08x", tvb_get_ntohl(tvb, offset+1) ); 
+           break;
+         case 11:
+            proto_tree_add_text ( tree, tvb, offset, 1,
+                                  "Adjacency State: %s", adj_state );
+            proto_tree_add_text ( tree, tvb, offset+1, 4,
+                                  "Extended Local circuit ID: 0x%08x", tvb_get_ntohl(tvb, offset+1) );
+            proto_tree_add_text ( tree, tvb, offset+5, 6,
+                                  "Neighbor SystemID: %s", print_system_id( tvb_get_ptr(tvb, offset+5, 6), 6 ) );
+           break;
+         case 15:
+           proto_tree_add_text ( tree, tvb, offset, 1,
+                                  "Adjacency State: %s", adj_state );
+            proto_tree_add_text ( tree, tvb, offset+1, 4,
+                                  "Extended Local circuit ID: 0x%08x", tvb_get_ntohl(tvb, offset+1) );
+            proto_tree_add_text ( tree, tvb, offset+5, 6,
+                                  "Neighbor SystemID: %s", print_system_id( tvb_get_ptr(tvb, offset+5, 6), 6 ) );  
+            proto_tree_add_text ( tree, tvb, offset+11, 4,
+                                  "Neighbor Extended Local circuit ID: 0x%08x", tvb_get_ntohl(tvb, offset+11) );
+           break;
+         default:
+           isis_dissect_unknown(tvb, pinfo, tree, offset,
+                                "malformed TLV (%d vs 1,5,11,15)", length );
+           return;
+       }
 }
 
 /*
@@ -336,22 +527,23 @@ dissect_hello_area_address_clv(const u_char *pd, int offset,
  *     (they tend to be an 802.3 MAC address, but its not required).
  *
  * Input:
- *     u_char * : packet data
- *     int : offset into packet data where we are.
- *     guint : length of clv we are decoding
- *     frame_data * : frame data (complete frame)
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : protocol display tree to fill out.  May be NULL
- *     gint : tree id to use for proto tree.
+ *     int : offset into packet data where we are.
+ *     int : length of IDs in packet.
+ *     int : length of clv we are decoding
  * 
  * Output:
  *     void, but we will add to proto tree if !NULL.
  */
-void 
-dissect_hello_is_neighbors_clv(const u_char *pd, int offset, 
-               guint length, frame_data *fd, proto_tree *tree ) {
+static void 
+dissect_hello_is_neighbors_clv(tvbuff_t *tvb, packet_info *pinfo,
+               proto_tree *tree, int offset, int id_length, int length)
+{
        while ( length > 0 ) {
                if (length<6) {
-                       isis_dissect_unknown(offset, length, tree, fd, 
+                       isis_dissect_unknown(tvb, pinfo, tree, offset,
                                "short is neighbor (%d vs 6)", length );
                        return;
                }
@@ -360,15 +552,14 @@ dissect_hello_is_neighbors_clv(const u_char *pd, int offset,
                 * format string.  
                 */
                if ( tree ) {
-                       proto_tree_add_text ( tree, NullTVB, offset, 6, 
-                               "IS Neighbor: %s", print_system_id( pd + offset, 6 ) ); 
+                       proto_tree_add_text ( tree, tvb, offset, 6, 
+                               "IS Neighbor: %s", print_system_id( tvb_get_ptr(tvb, offset, 6), 6 ) ); 
                }
                offset += 6;
                length -= 6;
        }
 }
 
-
 /*
  * Name: dissect_hello_padding_clv()
  *
@@ -377,107 +568,133 @@ dissect_hello_is_neighbors_clv(const u_char *pd, int offset,
  *     so we just return.
  *
  * Input:
- *     u_char * : packet data
- *     int : current offset into packet data
- *     guint : length of this clv
- *     frame_data * : frame data
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : proto tree to build on (may be null)
+ *     int : current offset into packet data
+ *     int : length of IDs in packet.
+ *     int : length of this clv
  *
  * Output:
  *     void
  */
 static void 
-dissect_hello_padding_clv(const u_char *pd, int offset, guint length, 
-               frame_data *fd, proto_tree *tree) {
+dissect_hello_padding_clv(tvbuff_t *tvb, packet_info *pinfo,
+       proto_tree *tree, int offset, int id_length, int length)
+{
        /* nothing to do here! */
 }
 
+
 /*
  * Name: isis_dissect_isis_hello()
  * 
  * Description:
  *     This procedure rips apart the various types of ISIS hellos.  L1H and
- *     L2H's are identicle for the most part, while the PTP hello has
+ *     L2H's are identical for the most part, while the PTP hello has
  *     a shorter header.
  *
  * Input:
- *     int : hello type, alla packet-isis.h ISIS_TYPE_* values
- *     int : header length of packet.
- *     u_char * : packet data
- *     int offset : our offset into packet data.
- *     frame_data * : frame data
+ *     tvbuff_t * : tvbuffer for packet data
+ *     packet_info * : info for current packet
  *     proto_tree * : protocol display tree to add to.  May be NULL.
+ *     int offset : our offset into packet data.
+ *     int : hello type, a la packet-isis.h ISIS_TYPE_* values
+ *     int : header length of packet.
+ *     int : length of IDs in packet.
  *
  * Output:
  *     void, will modify proto_tree if not NULL.
  */    
 void 
-isis_dissect_isis_hello(int hello_type, int header_length, 
-               const u_char *pd, int offset, frame_data *fd, proto_tree *tree){
-       isis_hello_t    *ihp;
+isis_dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+       int offset, int hello_type, int header_length, int id_length)
+{
        proto_item      *ti;
        proto_tree      *hello_tree = NULL;
        int             len;
-       int             hlen;
-
-       if (hello_type == ISIS_TYPE_PTP_HELLO) {
-               hlen = sizeof(*ihp) - 6;        /* make length correct */
-       } else {
-               hlen = sizeof(*ihp);
-       }
+       guint8          octet;
+       const guint8    *source_id;
+       guint16         pdu_length;
+       const guint8    *lan_id;
 
-       if (!BYTES_ARE_IN_FRAME(offset, hlen)) {
-               isis_dissect_unknown(offset, hlen, tree, fd,
-                       "not enough capture data for header (%d vs %d)",
-                       hlen, END_OF_FRAME);
+       if (!proto_is_protocol_enabled(proto_isis_hello)) {
+               call_dissector(data_handle,tvb_new_subset(tvb, offset,-1,tvb_reported_length_remaining(tvb,offset)), pinfo, tree);
                return;
        }
 
-       ihp = (isis_hello_t *) &pd[offset];     
-
        if (tree) {
-               ti = proto_tree_add_item(tree, proto_isis_hello, NullTVB,
-                       offset, END_OF_FRAME, FALSE);
+               ti = proto_tree_add_item(tree, proto_isis_hello, tvb,
+                       offset, tvb_length_remaining(tvb, offset), FALSE);
                hello_tree = proto_item_add_subtree(ti, ett_isis_hello);
-               proto_tree_add_uint_format(hello_tree, 
+               octet = tvb_get_guint8(tvb, offset);
+               proto_tree_add_uint_format(hello_tree,
                        hf_isis_hello_circuit_reserved,
-                       NullTVB, offset, 1, ihp->isis_hello_circuit_reserved,
+                       tvb, offset, 1, octet,
                        "Circuit type              : %s, reserved(0x%02x == 0)",
-                               val_to_str(ihp->isis_hello_circuit, 
+                               val_to_str(octet&ISIS_HELLO_CTYPE_MASK,
                                        isis_hello_circuit_type_vals,
                                        "Unknown (0x%x)"),
-                               ihp->isis_hello_creserved
+                               octet&ISIS_HELLO_CT_RESERVED_MASK
                        );
+       }
+       offset += 1;
 
-               proto_tree_add_string_format(hello_tree, hf_isis_hello_lan_id, NullTVB,
-                                   offset + 1, 6, ihp->isis_hello_source_id,
+       if (tree) {
+               source_id = tvb_get_ptr(tvb, offset, id_length);
+               proto_tree_add_bytes_format(hello_tree, hf_isis_hello_source_id, tvb,
+                                   offset, id_length, source_id,
                                    "SystemID{ Sender of PDU } : %s", 
-                     print_system_id( pd + offset + 1, 6 ) );
-               proto_tree_add_uint(hello_tree, hf_isis_hello_holding_timer, NullTVB,
-                                   offset + 7, 2,pntohs(&ihp->isis_hello_holding_timer[0]));
-               proto_tree_add_uint(hello_tree, hf_isis_hello_pdu_length, NullTVB,
-                                   offset + 9, 2,pntohs(&ihp->isis_hello_pdu_length[0]));
-               proto_tree_add_uint_format(hello_tree, hf_isis_hello_priority_reserved, NullTVB,
-                                   offset + 11, 1, ihp->isis_hello_priority_reserved,
-                                   "Priority                  : %d, reserved(0x%02x == 0)",
-                                        ihp->isis_hello_priority, ihp->isis_hello_preserved );
-               if (hello_type == ISIS_TYPE_PTP_HELLO) {
-                       proto_tree_add_uint(hello_tree, hf_isis_hello_local_circuit_id, NullTVB,
-                                        offset + 12, 1, ihp->isis_hello_lan_id[0] );
-               } else { 
-                       proto_tree_add_string_format(hello_tree, hf_isis_hello_lan_id, NullTVB, 
-                     offset + 12, 7, ihp->isis_hello_lan_id,
+                                   print_system_id( source_id, id_length ) );
+        }
+       offset += id_length;
+
+       if (tree) {
+               proto_tree_add_item(hello_tree, hf_isis_hello_holding_timer, tvb,
+                                   offset, 2, FALSE);
+       }
+       offset += 2;
+
+       pdu_length = tvb_get_ntohs(tvb, offset);
+       if (tree) {
+               proto_tree_add_uint(hello_tree, hf_isis_hello_pdu_length, tvb,
+                                   offset, 2, pdu_length);
+       }
+       offset += 2;
+
+       if (hello_type == ISIS_TYPE_PTP_HELLO) {
+               if (tree) {
+                       proto_tree_add_item(hello_tree, hf_isis_hello_local_circuit_id, tvb,
+                                        offset, 1, FALSE );
+               }
+               offset += 1;
+       } else { 
+
+                if (tree) {
+                        octet = tvb_get_guint8(tvb, offset);
+                        proto_tree_add_uint_format(hello_tree, hf_isis_hello_priority_reserved, tvb,
+                                    offset, 1, octet,
+                                    "Priority                  : %d, reserved(0x%02x == 0)",
+                                        octet&ISIS_HELLO_PRIORITY_MASK,
+                                        octet&ISIS_HELLO_P_RESERVED_MASK );
+                }
+                offset += 1;
+
+               if (tree) {
+                       lan_id = tvb_get_ptr(tvb, offset, id_length+1);
+                       proto_tree_add_bytes_format(hello_tree, hf_isis_hello_lan_id, tvb, 
+                                    offset, id_length + 1, lan_id,
                                         "SystemID{ Designated IS } : %s",
-                                             print_system_id( pd + offset + 12, 7 ) );
+                                             print_system_id( lan_id, id_length + 1 ) );
                }
+               offset += id_length + 1;
        }
 
-       offset += hlen;
-       len = pntohs(&ihp->isis_hello_pdu_length[0]);
+       len = pdu_length;
        len -= header_length;
        if (len < 0) {
-               isis_dissect_unknown(offset, header_length, tree, fd, 
-                       "packet header length %d went beyond packet", 
+               isis_dissect_unknown(tvb, pinfo, tree, offset,
+                       "Packet header length %d went beyond packet", 
                        header_length );
                return;
        }
@@ -486,14 +703,17 @@ isis_dissect_isis_hello(int hello_type, int header_length,
         * our list of valid ones!
         */
        if (hello_type == ISIS_TYPE_L1_HELLO){
-               isis_dissect_clvs ( clv_l1_hello_opts, len, pd, offset, fd, 
-                       hello_tree, ett_isis_hello_clv_unknown );
+               isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
+                       clv_l1_hello_opts, len, id_length,
+                       ett_isis_hello_clv_unknown);
        } else if (hello_type == ISIS_TYPE_L2_HELLO) {
-               isis_dissect_clvs ( clv_l2_hello_opts, len, pd, offset, fd, 
-                       hello_tree, ett_isis_hello_clv_unknown );
+               isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
+                       clv_l2_hello_opts, len, id_length,
+                       ett_isis_hello_clv_unknown);
        } else {
-               isis_dissect_clvs ( clv_ptp_hello_opts, len, pd, offset, fd, 
-                       hello_tree, ett_isis_hello_clv_unknown );
+               isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
+                       clv_ptp_hello_opts, len, id_length,
+                       ett_isis_hello_clv_unknown);
        }
 }
 
@@ -516,35 +736,43 @@ proto_register_isis_hello(void) {
        static hf_register_info hf[] = {
                { &hf_isis_hello_circuit_reserved,
                { "Circuit type              ", "isis_hello.circuite_type",
-                       FT_UINT8, BASE_HEX, NULL, 0x0, "" }},
+                       FT_UINT8, BASE_HEX, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_source_id,
                { "SystemID{ Sender of PDU } ", "isis_hello.source_id",
-                       FT_ETHER, BASE_HEX, NULL, 0x0, "" }},
+                       FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_holding_timer,
                { "Holding timer             ", "isis_hello.holding_timer", 
-                       FT_UINT16, BASE_DEC, NULL, 0x0, "" }},
+                       FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_pdu_length,
                { "PDU length                ", "isis_hello.pdu_length",
-                       FT_UINT16, BASE_DEC, NULL, 0x0, "" }},
+                       FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_priority_reserved,
-                { "Priority                 ", "isis_hello.priority",FT_UINT8, BASE_DEC, NULL, 
-                   ISIS_HELLO_P_RESERVED_MASK, "" }},
+                { "Priority                 ", "isis_hello.priority",
+                       FT_UINT8, BASE_DEC, NULL, ISIS_HELLO_P_RESERVED_MASK, "", HFILL }},
 
                { &hf_isis_hello_lan_id,
-               { "SystemID{ Designated IS } ", "isis_hello.lan_id", FT_STRING, BASE_DEC, NULL,
-         0x0, "" }},
+               { "SystemID{ Designated IS } ", "isis_hello.lan_id",
+                       FT_BYTES, BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_local_circuit_id,
-               { "Local circuit ID          ", "isis_hello.local_circuit_id", FT_UINT8,
-                  BASE_DEC, NULL, 0x0, "" }},
+               { "Local circuit ID          ", "isis_hello.local_circuit_id",
+                       FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_clv_ipv4_int_addr,
-               { "IPv4 interface address    ", "isis_hello.clv_ipv4_int_addr", FT_IPv4,
-                  BASE_NONE, NULL, 0x0, "" }},
+               { "IPv4 interface address    ", "isis_hello.clv_ipv4_int_addr",
+                       FT_IPv4, BASE_NONE, NULL, 0x0, "", HFILL }},
+
+               { &hf_isis_hello_clv_ipv6_int_addr,
+               { "IPv6 interface address    ", "isis_hello.clv_ipv6_int_addr",
+                       FT_IPv6, BASE_NONE, NULL, 0x0, "", HFILL }},
+
+               { &hf_isis_hello_clv_ptp_adj,
+               { "point-to-point Adjacency  ", "isis_hello.clv_ptp_adj",
+                       FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
 
        };
        static gint *ett[] = {
@@ -556,10 +784,18 @@ proto_register_isis_hello(void) {
                &ett_isis_hello_clv_nlpid,
                &ett_isis_hello_clv_auth,
                &ett_isis_hello_clv_ipv4_int_addr,
+               &ett_isis_hello_clv_ipv6_int_addr,
+               &ett_isis_hello_clv_ptp_adj,
+               &ett_isis_hello_clv_mt
        };
 
-       proto_isis_hello = proto_register_protocol("ISIS HELLO", "isis_hello");
+       proto_isis_hello = proto_register_protocol("ISIS HELLO",
+           "ISIS HELLO", "isis_hello");
        proto_register_field_array(proto_isis_hello, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
 }
 
+void
+proto_reg_handoff_isis_hello(void){
+  data_handle = find_dissector("data");
+}