Make "epan_init()" take, as additional arguments, pointers to routines
[obnox/wireshark/wip.git] / packet-isis-hello.c
index 1ffae4527cad6c6a6b3f8336a29e27a389b8c54f..4fc44057bf02496a258d5977c48e4777dde052e7 100644 (file)
@@ -1,23 +1,23 @@
 /* packet-isis-hello.c
  * Routines for decoding isis hello packets and their CLVs
  *
- * $Id: packet-isis-hello.c,v 1.28 2002/04/07 22:36:55 guy Exp $
+ * $Id: packet-isis-hello.c,v 1.34 2003/12/08 20:40:32 guy Exp $
  * Stuart Stanley <stuarts@mxmail.net>
  *
  * 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.
 # include "config.h"
 #endif
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
 #include <stdio.h>
 #include <string.h>
 #include <glib.h>
 #include "epan/resolv.h"
 
 /* hello packets */
-static int hf_isis_hello_circuit_reserved    = -1;
-static int hf_isis_hello_source_id           = -1;
-static int hf_isis_hello_holding_timer       = -1;
-static int hf_isis_hello_pdu_length          = -1;
-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 int hf_isis_hello_clv_restart         = -1;
-
-static gint ett_isis_hello                   = -1;
-static gint ett_isis_hello_clv_area_addr     = -1;
-static gint ett_isis_hello_clv_is_neighbors  = -1;
-static gint ett_isis_hello_clv_padding       = -1;
-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 int hf_isis_hello_circuit_reserved = -1;
+static int hf_isis_hello_source_id = -1;
+static int hf_isis_hello_holding_timer = -1;
+static int hf_isis_hello_pdu_length = -1;
+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;
+static gint ett_isis_hello_clv_is_neighbors = -1;
+static gint ett_isis_hello_clv_padding = -1;
+static gint ett_isis_hello_clv_unknown = -1;
+static gint ett_isis_hello_clv_nlpid = -1;
+static gint ett_isis_hello_clv_authentication = -1;
+static gint ett_isis_hello_clv_ip_authentication = -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 gint ett_isis_hello_clv_restart       = -1;
+static gint ett_isis_hello_clv_ptp_adj = -1;
+static gint ett_isis_hello_clv_mt = -1;
+static gint ett_isis_hello_clv_restart = -1;
+static gint ett_isis_hello_clv_checksum = -1;
 
 static const value_string isis_hello_circuit_type_vals[] = {
        { ISIS_HELLO_TYPE_RESERVED,     "Reserved 0 (discard PDU)"},
@@ -75,92 +72,102 @@ static const value_string isis_hello_circuit_type_vals[] = {
        { ISIS_HELLO_TYPE_LEVEL_12,     "Level 1 and 2"},
        { 0,            NULL} };
 
-/* 
+/*
  * Predclare dissectors for use in clv dissection.
  */
-static void dissect_hello_padding_clv(tvbuff_t *tvb, 
+static void dissect_hello_padding_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_is_neighbors_clv(tvbuff_t *tvb, 
+static void dissect_hello_is_neighbors_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_ptp_adj_clv(tvbuff_t *tvb, 
+static void dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_area_address_clv(tvbuff_t *tvb, 
+static void dissect_hello_area_address_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_auth_clv(tvbuff_t *tvb, 
+static void dissect_hello_authentication_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, 
+static void dissect_hello_ip_authentication_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, 
+static void dissect_hello_checksum_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_mt_clv(tvbuff_t *tvb, 
+static void dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_nlpid_clv(tvbuff_t *tvb, 
+static void dissect_hello_ip_int_addr_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
-static void dissect_hello_restart_clv(tvbuff_t *tvb, 
+static void dissect_hello_mt_clv(tvbuff_t *tvb,
+               proto_tree *tree, int offset, int id_length, int length);
+static void dissect_hello_nlpid_clv(tvbuff_t *tvb,
+               proto_tree *tree, int offset, int id_length, int length);
+static void dissect_hello_restart_clv(tvbuff_t *tvb,
                proto_tree *tree, int offset, int id_length, int length);
 
 
 static const isis_clv_handle_t clv_l1_hello_opts[] = {
        {
-               ISIS_CLV_L1H_AREA_ADDRESS,
+               ISIS_CLV_AREA_ADDRESS,
                "Area address(es)",
                &ett_isis_hello_clv_area_addr,
                dissect_hello_area_address_clv
        },
        {
-               ISIS_CLV_L1H_IS_NEIGHBORS,
+               ISIS_CLV_IS_NEIGHBORS,
                "IS Neighbor(s)",
                &ett_isis_hello_clv_is_neighbors,
                dissect_hello_is_neighbors_clv
        },
        {
-               ISIS_CLV_L1H_PADDING,
+               ISIS_CLV_PADDING,
                "Padding",
                &ett_isis_hello_clv_padding,
                dissect_hello_padding_clv
        },
        {
-               ISIS_CLV_L1H_NLPID,
+               ISIS_CLV_PROTOCOLS_SUPPORTED,
                "Protocols Supported",
                &ett_isis_hello_clv_nlpid,
                dissect_hello_nlpid_clv
        },
        {
-               ISIS_CLV_L1H_IP_INTERFACE_ADDR,
+               ISIS_CLV_IP_ADDR,
                "IP Interface address(es)",
                &ett_isis_hello_clv_ipv4_int_addr,
                dissect_hello_ip_int_addr_clv
        },
        {
-               ISIS_CLV_L1H_IPv6_INTERFACE_ADDR,
+               ISIS_CLV_IP6_ADDR,
                "IPv6 Interface address(es)",
                &ett_isis_hello_clv_ipv6_int_addr,
                dissect_hello_ipv6_int_addr_clv
        },
        {
-               ISIS_CLV_L1H_RESTART,
+               ISIS_CLV_RESTART,
                "Restart Signaling",
                &ett_isis_hello_clv_restart,
                dissect_hello_restart_clv
        },
        {
-               ISIS_CLV_L1H_AUTHENTICATION_NS,
-               "Authentication(non spec)",
-               &ett_isis_hello_clv_auth,
-               dissect_hello_auth_clv
+               ISIS_CLV_AUTHENTICATION,
+               "Authentication",
+               &ett_isis_hello_clv_authentication,
+               dissect_hello_authentication_clv
        },
        {
-               ISIS_CLV_L1H_AUTHENTICATION,
-               "Authentication",
-               &ett_isis_hello_clv_auth,
-               dissect_hello_auth_clv
+               ISIS_CLV_IP_AUTHENTICATION,
+               "IP Authentication",
+               &ett_isis_hello_clv_ip_authentication,
+               dissect_hello_ip_authentication_clv
        },
        {
-               ISIS_CLV_L1H_MT,
+               ISIS_CLV_MT_SUPPORTED,
                "Multi Topology",
                &ett_isis_hello_clv_mt,
                dissect_hello_mt_clv
        },
+       {
+               ISIS_CLV_CHECKSUM,
+               "Checksum",
+               &ett_isis_hello_clv_checksum,
+               dissect_hello_checksum_clv
+       },
        {
                0,
                "",
@@ -171,65 +178,71 @@ static const isis_clv_handle_t clv_l1_hello_opts[] = {
 
 static const isis_clv_handle_t clv_l2_hello_opts[] = {
        {
-               ISIS_CLV_L2H_AREA_ADDRESS,
+               ISIS_CLV_AREA_ADDRESS,
                "Area address(es)",
                &ett_isis_hello_clv_area_addr,
                dissect_hello_area_address_clv
        },
        {
-               ISIS_CLV_L2H_IS_NEIGHBORS,
+               ISIS_CLV_IS_NEIGHBORS,
                "IS Neighbor(s)",
                &ett_isis_hello_clv_is_neighbors,
                dissect_hello_is_neighbors_clv
        },
        {
-               ISIS_CLV_L2H_PADDING,
+               ISIS_CLV_PADDING,
                "Padding",
                &ett_isis_hello_clv_padding,
                dissect_hello_padding_clv
        },
        {
-               ISIS_CLV_L2H_NLPID,
+               ISIS_CLV_PROTOCOLS_SUPPORTED,
                "Protocols Supported",
                &ett_isis_hello_clv_nlpid,
                dissect_hello_nlpid_clv
        },
        {
-               ISIS_CLV_L2H_IP_INTERFACE_ADDR,
+               ISIS_CLV_IP_ADDR,
                "IP Interface address(es)",
                &ett_isis_hello_clv_ipv4_int_addr,
                dissect_hello_ip_int_addr_clv
        },
        {
-               ISIS_CLV_L2H_IPv6_INTERFACE_ADDR,
+               ISIS_CLV_IP6_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)",
-               &ett_isis_hello_clv_auth,
-               dissect_hello_auth_clv
+               ISIS_CLV_AUTHENTICATION,
+               "Authentication",
+               &ett_isis_hello_clv_authentication,
+               dissect_hello_authentication_clv
+       },
+       {
+               ISIS_CLV_IP_AUTHENTICATION,
+               "IP Authentication",
+               &ett_isis_hello_clv_ip_authentication,
+               dissect_hello_ip_authentication_clv
        },
        {
-               ISIS_CLV_L2H_RESTART,
+               ISIS_CLV_RESTART,
                "Restart Signaling",
                &ett_isis_hello_clv_restart,
                dissect_hello_restart_clv
        },
        {
-               ISIS_CLV_L2H_AUTHENTICATION,
-               "Authentication",
-               &ett_isis_hello_clv_auth,
-               dissect_hello_auth_clv
-       },
-       {
-               ISIS_CLV_L2H_MT,
+               ISIS_CLV_MT_SUPPORTED,
                "Multi Topology",
                &ett_isis_hello_clv_mt,
                dissect_hello_mt_clv
        },
+       {
+               ISIS_CLV_CHECKSUM,
+               "Checksum",
+               &ett_isis_hello_clv_checksum,
+               dissect_hello_checksum_clv
+       },
        {
                0,
                "",
@@ -240,65 +253,71 @@ static const isis_clv_handle_t clv_l2_hello_opts[] = {
 
 static const isis_clv_handle_t clv_ptp_hello_opts[] = {
        {
-               ISIS_CLV_PTP_AREA_ADDRESS,
+               ISIS_CLV_AREA_ADDRESS,
                "Area address(es)",
                &ett_isis_hello_clv_area_addr,
                dissect_hello_area_address_clv
        },
        {
-               ISIS_CLV_PTP_PADDING,
+               ISIS_CLV_PADDING,
                "Padding",
                &ett_isis_hello_clv_padding,
                dissect_hello_padding_clv
        },
        {
-               ISIS_CLV_PTP_NLPID,
+               ISIS_CLV_PROTOCOLS_SUPPORTED,
                "Protocols Supported",
                &ett_isis_hello_clv_nlpid,
                dissect_hello_nlpid_clv
        },
        {
-               ISIS_CLV_PTP_IP_INTERFACE_ADDR,
+               ISIS_CLV_IP_ADDR,
                "IP Interface address(es)",
                &ett_isis_hello_clv_ipv4_int_addr,
                dissect_hello_ip_int_addr_clv
        },
        {
-               ISIS_CLV_PTP_IPv6_INTERFACE_ADDR,
+               ISIS_CLV_IP6_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)",
-               &ett_isis_hello_clv_auth,
-               dissect_hello_auth_clv
+               ISIS_CLV_AUTHENTICATION,
+               "Authentication",
+               &ett_isis_hello_clv_authentication,
+               dissect_hello_authentication_clv
        },
        {
-               ISIS_CLV_PTP_AUTHENTICATION,
-               "Authentication",
-               &ett_isis_hello_clv_auth,
-               dissect_hello_auth_clv
+               ISIS_CLV_IP_AUTHENTICATION,
+               "IP Authentication",
+               &ett_isis_hello_clv_ip_authentication,
+               dissect_hello_ip_authentication_clv
        },
        {
-               ISIS_CLV_PTP_RESTART,
+               ISIS_CLV_RESTART,
                "Restart Option",
                &ett_isis_hello_clv_restart,
                dissect_hello_restart_clv
        },
        {
-               ISIS_CLV_PTP_ADJ,
+               ISIS_CLV_PTP_ADJ_STATE,
                "Point-to-point Adjacency State",
                &ett_isis_hello_clv_ptp_adj,
                dissect_hello_ptp_adj_clv
        },
        {
-               ISIS_CLV_PTP_MT,
+               ISIS_CLV_MT_SUPPORTED,
                "Multi Topology",
                &ett_isis_hello_clv_mt,
                dissect_hello_mt_clv
        },
+       {
+               ISIS_CLV_CHECKSUM,
+               "Checksum",
+               &ett_isis_hello_clv_checksum,
+               dissect_hello_checksum_clv
+       },
        {
                0,
                "",
@@ -317,20 +336,27 @@ static const isis_clv_handle_t clv_ptp_hello_opts[] = {
  *
  */
 
-static void 
-dissect_hello_restart_clv(tvbuff_t *tvb, 
-               proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_restart_clv(tvbuff_t *tvb,
+               proto_tree *tree, int offset, int id_length _U_, int length)
 {
        int restart_options;
 
+       if (length != 3) {
+           isis_dissect_unknown(tvb, tree, offset,
+                                "malformed TLV (%d vs 3)",
+                                length, 3 );
+           return;
+       }
+
        restart_options = tvb_get_guint8(tvb, offset);
 
-       proto_tree_add_text ( tree, tvb, offset, 1,        
+       proto_tree_add_text ( tree, tvb, offset, 1,
                              "Restart Request bit %s, "
                              "Restart Acknowledgement bit %s",
                              ISIS_MASK_RESTART_RR(restart_options) ? "set" : "clear",
-                             ISIS_MASK_RESTART_RA(restart_options) ? "set" : "clear"); 
-       proto_tree_add_text ( tree, tvb, offset+1, 2,        
+                             ISIS_MASK_RESTART_RA(restart_options) ? "set" : "clear");
+       proto_tree_add_text ( tree, tvb, offset+1, 2,
                              "Remaining holding time: %us",
                              tvb_get_ntohs(tvb, offset+1) );
 }
@@ -352,9 +378,9 @@ dissect_hello_restart_clv(tvbuff_t *tvb,
  * Output:
  *     void, will modify proto_tree if not null.
  */
-static void 
-dissect_hello_nlpid_clv(tvbuff_t *tvb, 
-       proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_nlpid_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
 {
        isis_dissect_nlpid_clv(tvb, tree, offset, length);
 }
@@ -377,9 +403,9 @@ dissect_hello_nlpid_clv(tvbuff_t *tvb,
  *     void, will modify proto_tree if not null.
  */
 
-static void 
-dissect_hello_mt_clv(tvbuff_t *tvb, 
-       proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_mt_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
 {
        isis_dissect_mt_clv(tvb, tree, offset, length,
                hf_isis_hello_clv_mt );
@@ -402,9 +428,9 @@ dissect_hello_mt_clv(tvbuff_t *tvb,
  * Output:
  *     void, will modify proto_tree if not null.
  */
-static void 
-dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, 
-       proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_ip_int_addr_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
 {
        isis_dissect_ip_int_clv(tvb, tree, offset, length,
                hf_isis_hello_clv_ipv4_int_addr );
@@ -427,21 +453,44 @@ dissect_hello_ip_int_addr_clv(tvbuff_t *tvb,
  * Output:
  *     void, will modify proto_tree if not null.
  */
-static void 
-dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb, 
-       proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
 {
        isis_dissect_ipv6_int_clv(tvb, tree, offset, length,
                hf_isis_hello_clv_ipv6_int_addr );
 }
 
 /*
- * Name: dissect_hello_auth_clv()
+ * Name: dissect_hello_authentication_clv()
+ *
+ * Description:
+ *     Decode for a hello packets authenticaion clv.
+ *      Calls into the CLV common one. 
+ *
+ * Input:
+ *     tvbuff_t * : tvbuffer for packet data
+ *     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_authentication_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
+{
+       isis_dissect_authentication_clv(tvb, tree, offset, length);
+}
+
+/*
+ * Name: dissect_hello_ip_authentication_clv()
  *
  * Description:
- *     Decode for a hello packets authenticaion clv.  Calls into the
- *     clv common one.  An auth inside a hello packet is a perlink
- *     password.
+ *     Decode for a hello packets IP authenticaion clv.
+ *      Calls into the CLV common one. 
  *
  * Input:
  *     tvbuff_t * : tvbuffer for packet data
@@ -453,20 +502,88 @@ dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb,
  * Output:
  *     void, will modify proto_tree if not null.
  */
-static void 
-dissect_hello_auth_clv(tvbuff_t *tvb, 
-       proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_ip_authentication_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
 {
-       isis_dissect_authentication_clv(tvb, tree, offset,
-               length, "authentication" );
+       isis_dissect_ip_authentication_clv(tvb, tree, offset, length);
 }
 
+/*
+ * Name: dissect_hello_checksum_clv()
+ *
+ * Description:
+ *      dump and verify the optional checksum in TLV 12
+ *
+ * Input:
+ *      tvbuff_t * : tvbuffer for packet data
+ *      proto_tree * : protocol display tree to fill out.  May be NULL
+ *      int : offset into packet data where we are.
+ *      int : length of clv we are decoding
+ *
+ * Output:
+ *      void, but we will add to proto tree if !NULL.
+ */
+
+static void
+dissect_hello_checksum_clv(tvbuff_t *tvb,
+        proto_tree *tree, int offset, int id_length _U_, int length) {
+
+       guint16 pdu_length,checksum, cacl_checksum=0;
+
+       if (tree) {
+                if ( length != 2 ) {
+                        proto_tree_add_text ( tree, tvb, offset, length,
+                                              "incorrect checksum length (%u), should be (2)", length );
+                        return;
+                }
+
+               checksum = tvb_get_ntohs(tvb, offset);                  
+
+                /* the check_and_get_checksum() function needs to know how big
+                 * the packet is. we can either pass through the pdu-len through several layers
+                 * of dissectors and wrappers or extract the PDU length field from the PDU specific header
+                 * which is offseted 17 bytes in IIHs (relative to the beginning of the IS-IS packet) */
+
+               pdu_length = tvb_get_ntohs(tvb, 17);   
+
+                /* unlike the LSP checksum verification which starts at an offset of 12 we start at offset 0*/
+               switch (check_and_get_checksum(tvb, 0, pdu_length, checksum, offset, &cacl_checksum))
+               {
+
+                       case NO_CKSUM :
+                                proto_tree_add_text ( tree, tvb, offset, length,
+                                                      "Checksum: 0x%04x (unused)", checksum);
+                               break;
+                       case DATA_MISSING :
+                               isis_dissect_unknown(tvb, tree, offset,
+                                                     "packet length %d went beyond packet",
+                                                     tvb_length_remaining(tvb, 0));
+                       break;
+                       case CKSUM_NOT_OK :
+                                proto_tree_add_text ( tree, tvb, offset, length,
+                                                      "Checksum: 0x%04x (incorrect, should be 0x%04x)",
+                                                      checksum,
+                                                      cacl_checksum);
+                       break;
+                       case CKSUM_OK :
+                                proto_tree_add_text ( tree, tvb, offset, length,
+                                                      "Checksum: 0x%04x (correct)", checksum);
+                       break;
+                       default :
+                               g_message("'check_and_get_checksum' returned an invalid value");
+               }
+       }
+}
+
+
+
 /*
  * Name: dissect_hello_area_address_clv()
  *
  * Description:
- *     Decode for a hello packets area address clv.  Calls into the
- *     clv common one.
+ *     Decode for a hello packets area address clv.
+ *      Calls into the CLV common one.
  *
  * Input:
  *     tvbuff_t * : tvbuffer for packet data
@@ -478,49 +595,44 @@ dissect_hello_auth_clv(tvbuff_t *tvb,
  * Output:
  *     void, will modify proto_tree if not null.
  */
-static void 
-dissect_hello_area_address_clv(tvbuff_t *tvb, 
-       proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_area_address_clv(tvbuff_t *tvb,
+       proto_tree *tree, int offset, int id_length _U_, int length)
 {
        isis_dissect_area_address_clv(tvb, tree, offset, length);
 }
 
 
 
-static void 
-dissect_hello_ptp_adj_clv(tvbuff_t *tvb, 
-               proto_tree *tree, int offset, int id_length, int length)
+static void
+dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
+               proto_tree *tree, int offset, int id_length _U_, 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 !!!>");
-           }
+       static const value_string adj_state_vals[] = {
+           { 0, "Up" },
+           { 1, "Initializing" },
+           { 2, "Down" },
+           { 0, NULL }
+       };
+       guint8 adj_state;
+       char *adj_state_str;
 
+       adj_state = tvb_get_guint8(tvb, offset);
+       adj_state_str = val_to_str(adj_state, adj_state_vals, "Unknown (%u)");
        switch(length) {
          case 1:
            proto_tree_add_text ( tree, tvb, offset, 1,
-                                 "Adjacency State: %s", adj_state );
+                                 "Adjacency State: %s", adj_state_str );
            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) ); 
+           proto_tree_add_text ( tree, tvb, offset, 1,
+                                  "Adjacency State: %s", adj_state_str );
+           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 );
+                                  "Adjacency State: %s", adj_state_str );
             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,
@@ -528,11 +640,11 @@ dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
            break;
          case 15:
            proto_tree_add_text ( tree, tvb, offset, 1,
-                                  "Adjacency State: %s", adj_state );
+                                  "Adjacency State: %s", adj_state_str );
             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 ) );  
+                                  "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;
@@ -545,7 +657,7 @@ dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
 
 /*
  * Name: isis_dissect_is_neighbors_clv()
- * 
+ *
  * Description:
  *     Take apart a IS neighbor packet.  A neighbor is n 6 byte packets.
  *     (they tend to be an 802.3 MAC address, but its not required).
@@ -556,13 +668,13 @@ dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
  *     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.
  */
-static void 
+static void
 dissect_hello_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
-       int id_length, int length)
+       int id_length _U_, int length)
 {
        while ( length > 0 ) {
                if (length<6) {
@@ -570,12 +682,12 @@ dissect_hello_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
                                "short is neighbor (%d vs 6)", length );
                        return;
                }
-               /* 
+               /*
                 * Lets turn the area address into "standard" 0000.0000.etc
-                * format string.  
+                * format string.
                 */
                if ( tree ) {
-                       proto_tree_add_text ( tree, tvb, offset, 6, 
+                       proto_tree_add_text ( tree, tvb, offset, 6,
                                "IS Neighbor: %s", get_ether_name( tvb_get_ptr(tvb, offset, 6)) );
                }
                offset += 6;
@@ -600,9 +712,9 @@ dissect_hello_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
  * Output:
  *     void
  */
-static void 
-dissect_hello_padding_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
-       int id_length, int length)
+static void
+dissect_hello_padding_clv(tvbuff_t *tvb _U_, proto_tree *tree _U_, int offset _U_,
+       int id_length _U_, int length _U_)
 {
        /* nothing to do here! */
 }
@@ -610,7 +722,7 @@ dissect_hello_padding_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
 
 /*
  * Name: isis_dissect_isis_hello()
- * 
+ *
  * Description:
  *     This procedure rips apart the various types of ISIS hellos.  L1H and
  *     L2H's are identical for the most part, while the PTP hello has
@@ -626,9 +738,9 @@ dissect_hello_padding_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
  *
  * Output:
  *     void, will modify proto_tree if not NULL.
- */    
-void 
-isis_dissect_isis_hello(tvbuff_t *tvb, proto_tree *tree, int offset,
+ */
+void
+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;
@@ -659,9 +771,13 @@ isis_dissect_isis_hello(tvbuff_t *tvb, proto_tree *tree, int offset,
                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", 
+                                   "System-ID {Sender of PDU} : %s", 
                                    print_system_id( source_id, id_length ) );
-        }
+       }
+       if (check_col(pinfo->cinfo, COL_INFO)) {
+               col_append_fstr(pinfo->cinfo, COL_INFO, ", System-ID: %s",
+                       print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) );
+       }
        offset += id_length;
 
        if (tree) {
@@ -683,23 +799,22 @@ isis_dissect_isis_hello(tvbuff_t *tvb, proto_tree *tree, int offset,
                                         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;
+       } 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",
+                       proto_tree_add_bytes_format(hello_tree, hf_isis_hello_lan_id, tvb,
+                                    offset, id_length + 1, lan_id,
+                                        "System-ID {Designated IS} : %s",
                                              print_system_id( lan_id, id_length + 1 ) );
                }
                offset += id_length + 1;
@@ -709,7 +824,7 @@ isis_dissect_isis_hello(tvbuff_t *tvb, proto_tree *tree, int offset,
        len -= header_length;
        if (len < 0) {
                isis_dissect_unknown(tvb, tree, offset,
-                       "Packet header length %d went beyond packet", 
+                       "Packet header length %d went beyond packet",
                        header_length );
                return;
        }
@@ -738,7 +853,7 @@ isis_dissect_isis_hello(tvbuff_t *tvb, proto_tree *tree, int offset,
  * Description:
  *     Register our protocol sub-sets with protocol manager.
  *
- * Input: 
+ * Input:
  *     int : protocol index for the ISIS protocol
  *
  * Output:
@@ -756,7 +871,7 @@ isis_register_hello(int proto_isis) {
                        FT_BYTES, BASE_HEX, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_holding_timer,
-               { "Holding timer             ", "isis.hello.holding_timer", 
+               { "Holding timer             ", "isis.hello.holding_timer",
                        FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},
 
                { &hf_isis_hello_pdu_length,
@@ -787,6 +902,9 @@ isis_register_hello(int proto_isis) {
                { "Point-to-point Adjacency  ", "isis.hello.clv_ptp_adj",
                        FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
 
+               { &hf_isis_hello_clv_mt,
+               { "MT-ID                     ", "isis.hello.clv_mt",
+                       FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
        };
        static gint *ett[] = {
                &ett_isis_hello,
@@ -795,12 +913,14 @@ isis_register_hello(int proto_isis) {
                &ett_isis_hello_clv_padding,
                &ett_isis_hello_clv_unknown,
                &ett_isis_hello_clv_nlpid,
-               &ett_isis_hello_clv_auth,
+               &ett_isis_hello_clv_authentication,
+               &ett_isis_hello_clv_ip_authentication,
                &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,
-               &ett_isis_hello_clv_restart
+               &ett_isis_hello_clv_restart,
+               &ett_isis_hello_clv_checksum
        };
 
        proto_register_field_array(proto_isis, hf, array_length(hf));