]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
display the DIS lan-id of an IIH in non-verbose mode
[tcpdump] / print-isoclns.c
index f50f79479d15dc23f24491e777ec00bfdd3d8fdf..f610fd323a28122d1a20028b9a1a092dcf3915d9 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.80 2003-04-09 12:46:38 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.102 2003-10-28 19:10:15 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -43,6 +43,7 @@ static const char rcsid[] =
 #include "ethertype.h"
 #include "ether.h"
 #include "extract.h"
+#include "gmpls.h"
 
 #define        NLPID_CLNS      129     /* 0x81 */
 #define        NLPID_ESIS      130     /* 0x82 */
@@ -106,10 +107,10 @@ static struct tok isis_pdu_values[] = {
 #define TLV_ISNEIGH_VARLEN      7   /* iso10589 */
 #define TLV_PADDING             8   /* iso10589 */
 #define TLV_LSP                 9   /* iso10589 */
-#define TLV_AUTH                10  /* iso10589, draft-ietf-isis-hmac-03 */
+#define TLV_AUTH                10  /* iso10589, rfc3567 */
 #define TLV_CHECKSUM            12  /* rfc3358 */
 #define TLV_LSP_BUFFERSIZE      14  /* iso10589 rev2 */
-#define TLV_EXT_IS_REACH        22  /* draft-ietf-isis-traffic-04 */
+#define TLV_EXT_IS_REACH        22  /* draft-ietf-isis-traffic-05 */
 #define TLV_IS_ALIAS_ID         24  /* draft-ietf-isis-ext-lsp-frags-02 */
 #define TLV_DECNET_PHASE4       42
 #define TLV_LUCENT_PRIVATE      66
@@ -119,10 +120,10 @@ static struct tok isis_pdu_values[] = {
 #define TLV_IDRP_INFO           131 /* rfc1195 */
 #define TLV_IPADDR              132 /* rfc1195 */
 #define TLV_IPAUTH              133 /* rfc1195 */
-#define TLV_TE_ROUTER_ID        134 /* draft-ietf-isis-traffic-04 */
-#define TLV_EXT_IP_REACH        135 /* draft-ietf-isis-traffic-04 */
+#define TLV_TE_ROUTER_ID        134 /* draft-ietf-isis-traffic-05 */
+#define TLV_EXT_IP_REACH        135 /* draft-ietf-isis-traffic-05 */
 #define TLV_HOSTNAME            137 /* rfc2763 */
-#define TLV_SHARED_RISK_GROUP   138 /* draft-ietf-isis-gmpls-extensions-14 */
+#define TLV_SHARED_RISK_GROUP   138 /* draft-ietf-isis-gmpls-extensions */
 #define TLV_NORTEL_PRIVATE1     176
 #define TLV_NORTEL_PRIVATE2     177
 #define TLV_HOLDTIME            198 /* ES-IS */
@@ -154,14 +155,14 @@ static struct tok isis_tlv_values[] = {
     { TLV_IS_ALIAS_ID,       "IS Alias ID"},
     { TLV_DECNET_PHASE4,     "DECnet Phase IV"},
     { TLV_LUCENT_PRIVATE,    "Lucent Proprietary"},
-    { TLV_IP_REACH,          "IPv4 Internal reachability"},
+    { TLV_IP_REACH,          "IPv4 Internal Reachability"},
     { TLV_PROTOCOLS,         "Protocols supported"},
-    { TLV_IP_REACH_EXT,      "IPv4 External reachability"},
+    { TLV_IP_REACH_EXT,      "IPv4 External Reachability"},
     { TLV_IDRP_INFO,         "Inter-Domain Information Type"},
     { TLV_IPADDR,            "IPv4 Interface address(es)"},
     { TLV_IPAUTH,            "IPv4 authentication (deprecated)"},
     { TLV_TE_ROUTER_ID,      "Traffic Engineering Router ID"},
-    { TLV_EXT_IP_REACH,      "Extended IPv4 reachability"},
+    { TLV_EXT_IP_REACH,      "Extended IPv4 Reachability"},
     { TLV_HOSTNAME,          "Hostname"},
     { TLV_SHARED_RISK_GROUP, "Shared Risk Link Group"},
     { TLV_NORTEL_PRIVATE1,   "Nortel Proprietary"},
@@ -171,30 +172,57 @@ static struct tok isis_tlv_values[] = {
     { TLV_MT_IS_REACH,       "Multi Topology IS Reachability"},
     { TLV_MT_SUPPORTED,      "Multi Topology"},
     { TLV_IP6ADDR,           "IPv6 Interface address(es)"},
-    { TLV_MT_IP_REACH,       "Multi-Topology IPv4 reachability"},
+    { TLV_MT_IP_REACH,       "Multi-Topology IPv4 Reachability"},
     { TLV_IP6_REACH,         "IPv6 reachability"},
-    { TLV_MT_IP6_REACH,      "Multi-Topology IP6 reachability"},
+    { TLV_MT_IP6_REACH,      "Multi-Topology IP6 Reachability"},
     { TLV_PTP_ADJ,           "Point-to-point Adjacency State"},
     { TLV_IIH_SEQNR,         "Hello PDU Sequence Number"},
     { TLV_VENDOR_PRIVATE,    "Vendor Private"},
     { 0, NULL }
 };
 
-#define SUBTLV_EXT_IS_REACH_ADMIN_GROUP           3
-#define SUBTLV_EXT_IS_REACH_LINK_LOCAL_ID         4
-#define SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID        5
-#define SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR        6
-#define SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR    8
-#define SUBTLV_EXT_IS_REACH_MAX_LINK_BW           9
-#define SUBTLV_EXT_IS_REACH_RESERVABLE_BW        10
-#define SUBTLV_EXT_IS_REACH_UNRESERVED_BW        11
-#define SUBTLV_EXT_IS_REACH_TE_METRIC            18
-#define SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20
-#define SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR    21
+#define SUBTLV_EXT_IS_REACH_ADMIN_GROUP           3 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID  4 /* draft-ietf-isis-gmpls-extensions */
+#define SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID        5 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR        6 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR    8 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_MAX_LINK_BW           9 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_RESERVABLE_BW        10 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_UNRESERVED_BW        11 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_TE_METRIC            18 /* draft-ietf-isis-traffic-05 */
+#define SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* draft-ietf-isis-gmpls-extensions */
+#define SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR    21 /* draft-ietf-isis-gmpls-extensions */
+
+static struct tok isis_ext_is_reach_subtlv_values[] = {
+    { SUBTLV_EXT_IS_REACH_ADMIN_GROUP,            "Administrative groups" },
+    { SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID,   "Link Local/Remote Identifier" },
+    { SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID,         "Link Remote Identifier" },
+    { SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR,         "IPv4 interface address" },
+    { SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR,     "IPv4 neighbor address" },
+    { SUBTLV_EXT_IS_REACH_MAX_LINK_BW,            "Maximum link bandwidth" },
+    { SUBTLV_EXT_IS_REACH_RESERVABLE_BW,          "Reservable link bandwidth" },
+    { SUBTLV_EXT_IS_REACH_UNRESERVED_BW,          "Unreserved bandwidth" },
+    { SUBTLV_EXT_IS_REACH_TE_METRIC,              "Traffic Engineering Metric" },
+    { SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE,   "Link Protection Type" },
+    { SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR,      "Interface Switching Capability" },
+    { 250,                                        "Reserved for cisco specific extensions" },
+    { 251,                                        "Reserved for cisco specific extensions" },
+    { 252,                                        "Reserved for cisco specific extensions" },
+    { 253,                                        "Reserved for cisco specific extensions" },
+    { 254,                                        "Reserved for cisco specific extensions" },
+    { 255,                                        "Reserved for future expansion" },
+    { 0, NULL }
+};
 
 #define SUBTLV_IP_REACH_ADMIN_TAG32               1
 #define SUBTLV_IP_REACH_ADMIN_TAG64               2
 
+static struct tok isis_ext_ip_reach_subtlv_values[] = {
+    { SUBTLV_IP_REACH_ADMIN_TAG32,                "32-Bit Administrative tag" },
+    { SUBTLV_IP_REACH_ADMIN_TAG64,                "64-Bit Administrative tag" },
+    { 0, NULL }
+};
+
 #define SUBTLV_AUTH_SIMPLE        1
 #define SUBTLV_AUTH_MD5          54
 #define SUBTLV_AUTH_MD5_LEN      16
@@ -244,9 +272,6 @@ static struct tok isis_mt_flag_values[] = {
 #define ISIS_MASK_TLV_EXT_IP6_IE(x)        ((x)&0x40)
 #define ISIS_MASK_TLV_EXT_IP6_SUBTLV(x)    ((x)&0x20)
 
-#define ISIS_MASK_TLV_RESTART_RR(x)        ((x)&0x1)
-#define ISIS_MASK_TLV_RESTART_RA(x)        ((x)&0x2)
-
 #define ISIS_LSP_TLV_METRIC_SUPPORTED(x)   ((x)&0x80)
 #define ISIS_LSP_TLV_METRIC_IE(x)          ((x)&0x40)
 #define ISIS_LSP_TLV_METRIC_UPDOWN(x)      ((x)&0x80)
@@ -254,45 +279,6 @@ static struct tok isis_mt_flag_values[] = {
 
 #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
 
-static struct tok isis_gmpls_link_prot_values[] = {
-    { 0x01, "Extra Traffic"},
-    { 0x02, "Unprotected"},
-    { 0x04, "Shared"},
-    { 0x08, "Dedicated 1:1"},
-    { 0x10, "Dedicated 1+1"},
-    { 0x20, "Enhanced"},
-    { 0x40, "Reserved"},
-    { 0x80, "Reserved"},
-    { 0, NULL }
-};
-
-static struct tok isis_gmpls_sw_cap_values[] = {
-    { 1,       "Packet-Switch Capable-1"},
-    { 2,       "Packet-Switch Capable-2"},
-    { 3,       "Packet-Switch Capable-3"},
-    { 4,       "Packet-Switch Capable-4"},
-    { 51,      "Layer-2 Switch Capable"},
-    { 100,     "Time-Division-Multiplex"},
-    { 150,     "Lambda-Switch Capable"},
-    { 200,     "Fiber-Switch Capable"},
-    { 0, NULL }
-};
-
-static struct tok isis_gmpls_lsp_enc_values[] = {
-    { 1,    "Packet"},
-    { 2,    "Ethernet V2/DIX"},
-    { 3,    "ANSI PDH"},
-    { 4,    "ETSI PDH"},
-    { 5,    "SDH ITU-T G.707"},
-    { 6,    "SONET ANSI T1.105"},
-    { 7,    "Digital Wrapper"},
-    { 8,    "Lambda (photonic)"},
-    { 9,    "Fiber"},
-    { 10,   "Ethernet 802.3"},
-    { 11,   "FiberChannel"},
-    { 0, NULL }
-};
-
 static struct tok isis_mt_values[] = {
     { 0,    "IPv4 unicast"},
     { 1,    "In-Band Management"},
@@ -386,6 +372,12 @@ static struct tok isis_is_reach_virtual_values[] = {
     { 0, NULL }
 };
 
+static struct tok isis_restart_flag_values[] = {
+    { 0x1,  "Restart Request"},
+    { 0x2,  "Restart Acknowledgement"},
+    { 0, NULL }
+};
+
 struct isis_common_header {
     u_int8_t nlpid;
     u_int8_t fixed_len;
@@ -444,24 +436,27 @@ struct isis_tlv_lsp {
 
 
 /* allocate space for the following string
- * xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx
- * 32 bytes plus one termination byte */
+ * xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx.xx
+ * 50 bytes plus one termination byte */
 static char *
 print_nsap(register const u_int8_t *pptr, register int nsap_length)
 {
        int nsap_idx;
-       static char nsap_ascii_output[33];
+       static char nsap_ascii_output[51];
         char *junk_buf = nsap_ascii_output;
 
-        if (nsap_length < 1 || nsap_length > 13) {
-                sprintf(junk_buf, "illegal length");
+        if (nsap_length < 1 || nsap_length > 20) {
+                snprintf(nsap_ascii_output, sizeof(nsap_ascii_output),
+                    "illegal length");
                 return (nsap_ascii_output);
         }
 
        for (nsap_idx = 0; nsap_idx < nsap_length; nsap_idx++) {
                if (!TTEST2(*pptr, 1))
                        return (0);
-               sprintf(junk_buf, "%02x", *pptr++);
+               snprintf(junk_buf,
+                   sizeof(nsap_ascii_output) - (junk_buf - nsap_ascii_output),
+                   "%02x", *pptr++);
                junk_buf += strlen(junk_buf);
                if (((nsap_idx & 1) == 0) &&
                      (nsap_idx + 1 < nsap_length)) {
@@ -479,8 +474,7 @@ print_nsap(register const u_int8_t *pptr, register int nsap_length)
 #define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
 #define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
 
-void isoclns_print(const u_int8_t *p, u_int length, u_int caplen,
-             const u_int8_t *esrc, const u_int8_t *edst)
+void isoclns_print(const u_int8_t *p, u_int length, u_int caplen)
 {
        u_int8_t pdu_type;
        const struct isis_common_header *header;
@@ -488,11 +482,7 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen,
        header = (const struct isis_common_header *)p;
        pdu_type = header->pdu_type & PDU_TYPE_MASK;
 
-        printf("%sOSI ", caplen < 1 ? "|" : "");
-        if (!eflag && esrc != NULL && edst != NULL)
-                (void)printf("%s > %s, ",
-                         etheraddr_string(esrc),
-                         etheraddr_string(edst));
+        printf("%sOSI", caplen < 1 ? "|" : "");
 
         if (caplen < 1) /* enough bytes on the wire ? */
                 return;
@@ -500,7 +490,7 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen,
        switch (*p) {
 
        case NLPID_CLNS:
-               (void)printf("CLNS, length: %u", length);
+               (void)printf(", CLNS, length %u", length);
                break;
 
        case NLPID_ESIS:
@@ -513,11 +503,11 @@ void isoclns_print(const u_int8_t *p, u_int length, u_int caplen,
                break;
 
        case NLPID_NULLNS:
-               (void)printf("ISO NULLNS, length: %u", length);
+               (void)printf("ISO NULLNS, length: %u", length);
                break;
 
        default:
-               (void)printf("Unknown NLPID 0x%02x, length: %u", p[0], length);
+               (void)printf("Unknown NLPID 0x%02x, length: %u", p[0], length);
                if (caplen > 1)
                         print_unknown_data(p,"\n\t",caplen);
                break;
@@ -578,7 +568,7 @@ esis_print(const u_int8_t *p, u_int length)
                return;
        }
 
-        printf("ES-IS, %s, length: %u",
+        printf(", ES-IS, %s, length %u",
                tok2str(esis_values,"unknown type: %u",eh->type & 0x1f),
                length);
 
@@ -696,75 +686,33 @@ esis_print(const u_int8_t *p, u_int length)
                }
 }
 
-/* allocate space for the following string
- * xxxx.xxxx.xxxx
- * 14 bytes plus one termination byte */
-static char *
-isis_print_sysid(const u_int8_t *cp, int sysid_len)
-{
-       int i;
-       static char sysid[15];
-        char *pos = sysid;
-
-       for (i = 1; i <= sysid_len; i++) {
-               if (!TTEST2(*cp, 1))
-                       return (0);
-               sprintf(pos, "%02x", *cp++);
-               pos += strlen(pos);
-               if ((i==2)^(i==4)) {
-                       *pos++ = '.';
-               }
-       }
-        *(pos) = '\0';
-       return (sysid);
-}
-
-
-/* allocate space for the following string
- * xxxx.xxxx.xxxx.yy
- * 17 bytes plus one termination byte */
-static char *
-isis_print_nodeid(const u_int8_t *cp)
-{
-       int i;
-       static char nodeid[18];
-        char *pos = nodeid;
-
-       for (i = 1; i <= 7; i++) {
-               if (!TTEST2(*cp, 1))
-                       return (0);
-               sprintf(pos, "%02x", *cp++);
-               pos += strlen(pos);
-               if ((i & 1) == 0) {
-                       *pos++ = '.';
-               }
-       }
-        *(pos) = '\0';
-       return (nodeid);
-}
-
-/* allocate space for the following string
+/* shared routine for printing system, node and lsp-ids
+ * allocate space for the worst-case string
  * xxxx.xxxx.xxxx.yy-zz
  * 20 bytes plus one termination byte */
 static char *
-isis_print_lspid(const u_int8_t *cp)
+isis_print_id(const u_int8_t *cp, int id_len)
 {
-       int i;
-       static char lspid[21];
-        char *pos = lspid;
-
-       for (i = 1; i <= 7; i++) {
-               sprintf(pos, "%02x", *cp++);
-               pos += strlen(pos);
-               if ((i & 1) == 0)
-                       *pos++ = '.';
+    int i;
+    static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
+    char *pos = id;
+
+    for (i = 1; i <= SYSTEM_ID_LEN; i++) {
+        snprintf(pos, sizeof(id) - (pos - id), "%02x", *cp++);
+       pos += strlen(pos);
+       if (i == 2 || i == 4)
+           *pos++ = '.';
        }
-       sprintf(pos, "-%02x", *cp);
-        return (lspid);
+    if (id_len >= NODE_ID_LEN) {
+        snprintf(pos, sizeof(id) - (pos - id), ".%02x", *cp++);
+       pos += strlen(pos);
+    }
+    if (id_len == LSP_ID_LEN)
+        snprintf(pos, sizeof(id) - (pos - id), "-%02x", *cp);
+    return (id);
 }
 
 /* print the 4-byte metric block which is common found in the old-style TLVs */
-
 static int
 isis_print_metric_block (const struct isis_metric_block *isis_metric_block)
 {
@@ -797,7 +745,7 @@ isis_print_tlv_ip_reach (const u_int8_t *cp, const char *ident, int length)
 
        while (length > 0) {
                if ((size_t)length < sizeof(*tlv_ip_reach)) {
-                       printf("short IPv4 reachability (%d vs %lu)",
+                       printf("short IPv4 Reachability (%d vs %lu)",
                                length,
                                (unsigned long)sizeof(*tlv_ip_reach));
                        return (0);
@@ -856,13 +804,22 @@ isis_print_tlv_ip_reach (const u_int8_t *cp, const char *ident, int length)
 static int
 isis_print_ip_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) {
 
+        /* first lets see if we know the subTLVs name*/
+       printf("%s%s subTLV #%u, length: %u",
+              ident,
+               tok2str(isis_ext_ip_reach_subtlv_values,
+                       "unknown",
+                       subt),
+               subt,
+               subl);
+
+       if (!TTEST2(*tptr,subl))
+           goto trunctlv;
+
     switch(subt) {
     case SUBTLV_IP_REACH_ADMIN_TAG32:
         while (subl >= 4) {
-           if (!TTEST2(*tptr,4))
-               goto trunctlv;
-           printf("%s32-Bit Administrative tag: 0x%08x (=%u)",
-                  ident,
+           printf(", 0x%08x (=%u)",
                   EXTRACT_32BITS(tptr),
                   EXTRACT_32BITS(tptr));
            tptr+=4;
@@ -871,10 +828,7 @@ isis_print_ip_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
        break;
     case SUBTLV_IP_REACH_ADMIN_TAG64:
         while (subl >= 8) {
-           if (!TTEST2(*tptr,8))
-               goto trunctlv;
-           printf("%s64-Bit Administrative tag: 0x%08x%08x",
-                  ident,
+           printf(", 0x%08x%08x",
                   EXTRACT_32BITS(tptr),
                   EXTRACT_32BITS(tptr+4));
            tptr+=8;
@@ -882,10 +836,6 @@ isis_print_ip_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
        }
        break;
     default:
-        printf("%sunknown subTLV, type %d, length %d",
-              ident,
-              subt,
-              subl);
        if(!print_unknown_data(tptr,"\n\t\t    ",
                               subl))
          return(0);
@@ -906,150 +856,87 @@ trunctlv:
 static int
 isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *ident) {
 
-        int i;
+        int priority_level;
         union { /* int to float conversion buffer for several subTLVs */
             float f; 
             u_int32_t i;
         } bw;
 
+        /* first lets see if we know the subTLVs name*/
+       printf("%s%s subTLV #%u, length: %u",
+              ident,
+               tok2str(isis_ext_is_reach_subtlv_values,
+                       "unknown",
+                       subt),
+               subt,
+               subl);
+
+       if (!TTEST2(*tptr,subl))
+           goto trunctlv;
+
         switch(subt) {
-        case SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
-            printf("%sAdministrative groups: 0x%08x",
-                   ident,
-                   EXTRACT_32BITS(tptr));
-            break;
-        case SUBTLV_EXT_IS_REACH_LINK_LOCAL_ID:
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
-            printf("%sLink Local Identifier: 0x%08x",
-                   ident,
-                   EXTRACT_32BITS(tptr));
-            break;
+        case SUBTLV_EXT_IS_REACH_ADMIN_GROUP:      
+        case SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
         case SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
-            printf("%sLink Remote Identifier: 0x%08x",
-                   ident,
-                   EXTRACT_32BITS(tptr));
+            printf(", 0x%08x", EXTRACT_32BITS(tptr));
+           if (subl == 8) /* draft-ietf-isis-gmpls-extensions */
+             printf(", 0x%08x", EXTRACT_32BITS(tptr+4));
+           break;
+        case SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
+        case SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
+            printf(", %s", ipaddr_string(tptr));
             break;
         case SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
-            bw.i = EXTRACT_32BITS(tptr);
-            printf("%sMaximum link bandwidth : %.3f Mbps",
-                   ident,
-                   bw.f*8/1000000 );
-            break;
-        case SUBTLV_EXT_IS_REACH_RESERVABLE_BW :
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
+       case SUBTLV_EXT_IS_REACH_RESERVABLE_BW:  
             bw.i = EXTRACT_32BITS(tptr);
-            printf("%sReservable link bandwidth: %.3f Mbps",
-                   ident,
-                   bw.f*8/1000000  );
+            printf(", %.3f Mbps", bw.f*8/1000000 );
             break;
         case SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
-            printf("%sUnreserved bandwidth:",ident);
-            for (i = 0; i < 8; i++) {
-                if (!TTEST2(*(tptr+i*4),4))
-                    goto trunctlv;
+            for (priority_level = 0; priority_level < 8; priority_level++) {
                 bw.i = EXTRACT_32BITS(tptr);
                 printf("%s  priority level %d: %.3f Mbps",
                        ident,
-                       i,
+                       priority_level,
                        bw.f*8/1000000 );
+               tptr+=4;
             }
             break;
         case SUBTLV_EXT_IS_REACH_TE_METRIC:
-            if (!TTEST2(*tptr,3))
-                goto trunctlv;
-            printf("%sTraffic Engineering Metric: %d",
-                   ident,
-                   EXTRACT_24BITS(tptr));
-            break;
-        case SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
-            printf("%sIPv4 interface address: %s",
-                   ident,
-                   ipaddr_string(tptr));
-            break;
-        case SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
-            if (!TTEST2(*tptr,4))
-                goto trunctlv;
-            printf("%sIPv4 neighbor address: %s",
-                   ident,
-                   ipaddr_string(tptr));
+            printf(", %u", EXTRACT_24BITS(tptr));
             break;
         case SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
-            if (!TTEST2(*tptr,2))
-                goto trunctlv;
-            printf("%sLink Protection Type: %s, Priority %u",
-                   ident,
-                   bittok2str(isis_gmpls_link_prot_values, "none", *tptr),
+            printf(", %s, Priority %u",
+                  bittok2str(gmpls_link_prot_values, "none", *tptr),
                    *(tptr+1));
             break;
         case SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
-            printf("%sInterface Switching Capability",ident);
-
-            if (!TTEST2(*tptr,1))
-                goto trunctlv;
             printf("%s  Interface Switching Capability:%s",
                    ident,
-                   tok2str(isis_gmpls_sw_cap_values, "Unknown", *(tptr)));
-
-            if (!TTEST2(*(tptr+1),1))
-                goto trunctlv;
+                   tok2str(gmpls_switch_cap_values, "Unknown", *(tptr)));
             printf(", LSP Encoding: %s",
-                   tok2str(isis_gmpls_lsp_enc_values, "Unknown", *(tptr+1)));
-
-            if (!TTEST2(*(tptr+2),2)) /* skip 2 res. bytes */
-                goto trunctlv;
-
+                   tok2str(gmpls_encoding_values, "Unknown", *(tptr+1)));
+           tptr+=4;
             printf("%s  Max LSP Bandwidth:",ident);
-            for (i = 0; i < 8; i++) {
-                if (!TTEST2(*(tptr+(i*4)+4),4))
-                    goto trunctlv;
+            for (priority_level = 0; priority_level < 8; priority_level++) {
                 bw.i = EXTRACT_32BITS(tptr);
                 printf("%s    priority level %d: %.3f Mbps",
                        ident,
-                       i,
+                       priority_level,
                        bw.f*8/1000000 );
+               tptr+=4;
             }
             subl-=36;
             /* there is some optional stuff left to decode but this is as of yet
                not specified so just lets hexdump what is left */
             if(subl>0){
                 if(!print_unknown_data(tptr,"\n\t\t    ",
-                                           subl-36))
+                                      subl-36))
                     return(0);
             }
             break;
-        case 250:
-        case 251:
-        case 252:
-        case 253:
-        case 254:
-            printf("%sReserved for cisco specific extensions, type %d, length %d",
-                   ident,
-                   subt,
-                   subl);
-            break;
-        case 255:
-            printf("%sReserved for future expansion, type %d, length %d",
-                   ident,
-                   subt,
-                   subl);
-            break;
         default:
-            printf("%sunknown subTLV, type %d, length %d",
-                   ident,
-                   subt,
-                   subl);
             if(!print_unknown_data(tptr,"\n\t\t    ",
-                                       subl))
+                                  subl))
                 return(0);
             break;
         }
@@ -1076,7 +963,7 @@ isis_print_ext_is_reach (const u_int8_t *tptr,const char *ident, int tlv) {
     if (!TTEST2(*tptr, NODE_ID_LEN))
         return(0);
 
-    printf("%sIS Neighbor: %s", ident, isis_print_nodeid(tptr));
+    printf("%sIS Neighbor: %s", ident, isis_print_id(tptr, NODE_ID_LEN));
     tptr+=(NODE_ID_LEN);
 
     if (tlv != TLV_IS_ALIAS_ID) {
@@ -1257,8 +1144,8 @@ static int isis_print (const u_int8_t *p, u_int length)
     u_int8_t pdu_type, max_area, id_length, tlv_type, tlv_len, tmp, alen, lan_alen, prefix_len;
     u_int8_t ext_is_len, ext_ip_len, mt_len;
     const u_int8_t *optr, *pptr, *tptr;
-    u_short packet_len,pdu_len,time_remain;
-    u_int i,ra,rr;
+    u_short packet_len,pdu_len;
+    u_int i;
 
     packet_len=length;
     optr = p; /* initialize the _o_riginal pointer to the packet start -
@@ -1333,18 +1220,52 @@ static int isis_print (const u_int8_t *p, u_int length)
 
     pdu_type=header->pdu_type;
 
-    /* in non-verbose mode just lets print the basic PDU Type*/
+    /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
     if (vflag < 1) {
-        printf("IS-IS, %s, length: %u",
-               tok2str(isis_pdu_values,"unknown PDU-Type %u",pdu_type),
-               length);
+        printf(", IS-IS, %s",
+               tok2str(isis_pdu_values,"unknown PDU-Type %u",pdu_type));
+
+       switch (pdu_type) {
+
+       case L1_LAN_IIH:
+       case L2_LAN_IIH:
+           printf(", source-id %s",
+                   isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN));
+           printf(", DIS lan-id %s",
+                   isis_print_id(header_iih_lan->lan_id,NODE_ID_LEN));
+           break;
+       case PTP_IIH:
+           printf(", source-id %s", isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN));
+           break;
+       case L1_LSP:
+       case L2_LSP:
+           printf(", lsp-id %s, seq 0x%08x, lifetime %5us",
+                  isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
+                  EXTRACT_32BITS(header_lsp->sequence_number),
+                  EXTRACT_16BITS(header_lsp->remaining_lifetime));
+           break;
+       case L1_CSNP:
+       case L2_CSNP:
+           printf(", source-id %s", isis_print_id(header_csnp->source_id,SYSTEM_ID_LEN));
+           break;
+       case L1_PSNP:
+       case L2_PSNP:
+           printf(", source-id %s", isis_print_id(header_psnp->source_id,SYSTEM_ID_LEN));
+           break;
+
+       }
+       printf(", length %u", length);
+
         return(1);
     }
 
     /* ok they seem to want to know everything - lets fully decode it */
-    printf("IS-IS, length: %u",length);
+    printf("IS-IS, length: %u",length);
 
-    printf("\n\thlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
+    printf("\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
+           tok2str(isis_pdu_values,
+                   "unknown, type %u",
+                   pdu_type),
            header->fixed_len,
            header->version,
            header->pdu_version,
@@ -1353,12 +1274,6 @@ static int isis_print (const u_int8_t *p, u_int length)
            max_area,
            header->max_area);
 
-    /* first lets see if we know the PDU name*/
-    printf(", pdu-type: %s",
-           tok2str(isis_pdu_values,
-                   "unknown, type %u",
-                   pdu_type));
-
     if (vflag > 1) {
         if(!print_unknown_data(optr,"\n\t",8)) /* provide the _o_riginal pointer */
             return(0);                         /* for optionally debugging the common header */
@@ -1381,15 +1296,15 @@ static int isis_print (const u_int8_t *p, u_int length)
        }
 
        TCHECK(*header_iih_lan);
-       printf("\n\t  source-id: %s,  holding time: %us, Flags: [%s]",
-               isis_print_sysid(header_iih_lan->source_id,SYSTEM_ID_LEN),
+       printf("\n\t  source-id:  %s,  holding time: %us, Flags: [%s]",
+               isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN),
                EXTRACT_16BITS(header_iih_lan->holding_time),
                tok2str(isis_iih_circuit_type_values,
                        "unknown circuit type 0x%02x",
                        header_iih_lan->circuit_type));
 
-       printf("\n\t  lan-id:    %s, Priority: %u, PDU length: %u",
-               isis_print_nodeid(header_iih_lan->lan_id),
+       printf("\n\t  DIS lan-id: %s, Priority: %u, PDU length: %u",
+               isis_print_id(header_iih_lan->lan_id, NODE_ID_LEN),
                (header_iih_lan->priority) & PRIORITY_MASK,
                pdu_len);
 
@@ -1416,13 +1331,15 @@ static int isis_print (const u_int8_t *p, u_int length)
        }
 
        TCHECK(*header_iih_ptp);
-       printf("\n\t  source-id: %s, holding time: %us, circuit-id: 0x%02x, %s, PDU length: %u",
-               isis_print_sysid(header_iih_ptp->source_id,SYSTEM_ID_LEN),
+       printf("\n\t  source-id: %s, holding time: %us, Flags: [%s]",
+               isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN),
                EXTRACT_16BITS(header_iih_ptp->holding_time),
-               header_iih_ptp->circuit_id,
                tok2str(isis_iih_circuit_type_values,
                        "unknown circuit type 0x%02x",
-                       header_iih_ptp->circuit_type),
+                       header_iih_ptp->circuit_type));
+
+       printf("\n\t  circuit-id: 0x%02x, PDU length: %u",
+               header_iih_ptp->circuit_id,
                pdu_len);
 
         if (vflag > 1) {
@@ -1450,7 +1367,7 @@ static int isis_print (const u_int8_t *p, u_int length)
 
        TCHECK(*header_lsp);
        printf("\n\t  lsp-id: %s, seq: 0x%08x, lifetime: %5us",
-               isis_print_lspid(header_lsp->lsp_id),
+               isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
                EXTRACT_32BITS(header_lsp->sequence_number),
                EXTRACT_16BITS(header_lsp->remaining_lifetime));
         /* verify the checksum -
@@ -1498,12 +1415,12 @@ static int isis_print (const u_int8_t *p, u_int length)
 
        TCHECK(*header_csnp);
        printf("\n\t  source-id:    %s, PDU length: %u",
-               isis_print_nodeid(header_csnp->source_id),
+               isis_print_id(header_csnp->source_id, NODE_ID_LEN),
                pdu_len);
        printf("\n\t  start lsp-id: %s",
-               isis_print_lspid(header_csnp->start_lsp_id));
+               isis_print_id(header_csnp->start_lsp_id, LSP_ID_LEN));
        printf("\n\t  end lsp-id:   %s",
-               isis_print_lspid(header_csnp->end_lsp_id));
+               isis_print_id(header_csnp->end_lsp_id, LSP_ID_LEN));
 
         if (vflag > 1) {
             if(!print_unknown_data(pptr,"\n\t  ",ISIS_CSNP_HEADER_SIZE))
@@ -1529,8 +1446,9 @@ static int isis_print (const u_int8_t *p, u_int length)
        }
 
        TCHECK(*header_psnp);
-       printf("\n\t  source-id:    %s",
-               isis_print_nodeid(header_psnp->source_id));
+       printf("\n\t  source-id:    %s, PDU length: %u",
+               isis_print_id(header_psnp->source_id, NODE_ID_LEN),
+               pdu_len);
 
         if (vflag > 1) {
             if(!print_unknown_data(pptr,"\n\t  ",ISIS_PSNP_HEADER_SIZE))
@@ -1601,7 +1519,7 @@ static int isis_print (const u_int8_t *p, u_int length)
            while (tmp >= ETHER_ADDR_LEN) {
                 if (!TTEST2(*tptr, ETHER_ADDR_LEN))
                     goto trunctlv;
-                printf("\n\t      IS Neighbor: %s",isis_print_sysid(tptr,ETHER_ADDR_LEN));
+                printf("\n\t      SNPA: %s",isis_print_id(tptr,ETHER_ADDR_LEN));
                 tmp -= ETHER_ADDR_LEN;
                 tptr += ETHER_ADDR_LEN;
            }
@@ -1616,7 +1534,7 @@ static int isis_print (const u_int8_t *p, u_int length)
            while (tmp >= lan_alen) {
                 if (!TTEST2(*tptr, lan_alen))
                     goto trunctlv;
-                printf("\n\t\tIS Neighbor: %s",isis_print_sysid(tptr,lan_alen));
+                printf("\n\t\tIS Neighbor: %s",isis_print_id(tptr,lan_alen));
                 tmp -= lan_alen;
                 tptr +=lan_alen;
             }
@@ -1672,7 +1590,8 @@ static int isis_print (const u_int8_t *p, u_int length)
             while (tmp >= sizeof(struct isis_tlv_is_reach)) {
                if (!TTEST(*tlv_is_reach))
                    goto trunctlv;
-               printf("\n\t      IS Neighbor: %s", isis_print_nodeid(tlv_is_reach->neighbor_nodeid));
+               printf("\n\t      IS Neighbor: %s",
+                      isis_print_id(tlv_is_reach->neighbor_nodeid, NODE_ID_LEN));
                 isis_print_metric_block(&tlv_is_reach->isis_metric_block);
                tmp -= sizeof(struct isis_tlv_is_reach);
                tlv_is_reach++;
@@ -1685,7 +1604,7 @@ static int isis_print (const u_int8_t *p, u_int length)
                if (!TTEST(*tlv_es_reach))
                    goto trunctlv;
                printf("\n\t      ES Neighbor: %s",
-                       isis_print_sysid(tlv_es_reach->neighbor_sysid,SYSTEM_ID_LEN));
+                       isis_print_id(tlv_es_reach->neighbor_sysid,SYSTEM_ID_LEN));
                 isis_print_metric_block(&tlv_es_reach->isis_metric_block);
                tmp -= sizeof(struct isis_tlv_es_reach);
                tlv_es_reach++;
@@ -1820,7 +1739,7 @@ static int isis_print (const u_int8_t *p, u_int length)
                if (!TTEST2(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN))
                    goto trunctlv;
                printf("\n\t      Neighbor SystemID: %s",
-                      isis_print_sysid(tlv_ptp_adj->neighbor_sysid,SYSTEM_ID_LEN));
+                      isis_print_id(tlv_ptp_adj->neighbor_sysid,SYSTEM_ID_LEN));
                tmp-=SYSTEM_ID_LEN;
            }
            if(tmp>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) {
@@ -1876,13 +1795,13 @@ static int isis_print (const u_int8_t *p, u_int length)
        case TLV_SHARED_RISK_GROUP:
            if (!TTEST2(*tptr, NODE_ID_LEN))
                 goto trunctlv;
-           printf("\n\t      IS Neighbor: %s", isis_print_nodeid(tptr));
+           printf("\n\t      IS Neighbor: %s", isis_print_id(tptr, NODE_ID_LEN));
            tptr+=(NODE_ID_LEN);
            tmp-=(NODE_ID_LEN);
 
            if (!TTEST2(*tptr, 1))
                 goto trunctlv;
-           printf(", %s", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered");
+           printf(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr++) ? "numbered" : "unnumbered");
            tmp--;
 
            if (!TTEST2(*tptr,4))
@@ -1909,11 +1828,10 @@ static int isis_print (const u_int8_t *p, u_int length)
        case TLV_LSP:
            tlv_lsp = (const struct isis_tlv_lsp *)tptr;
            while(tmp>0) {
-               printf("\n\t      lsp-id: %s",
-                       isis_print_nodeid(tlv_lsp->lsp_id));
-               if (!TTEST((tlv_lsp->lsp_id)[NODE_ID_LEN]))
+               if (!TTEST((tlv_lsp->lsp_id)[LSP_ID_LEN]))
                    goto trunctlv;
-               printf("-%02x",(tlv_lsp->lsp_id)[NODE_ID_LEN]);
+               printf("\n\t      lsp-id: %s",
+                       isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN));
                if (!TTEST2(tlv_lsp->sequence_number, 4))
                    goto trunctlv;
                printf(", seq: 0x%08x",EXTRACT_32BITS(tlv_lsp->sequence_number));
@@ -1956,12 +1874,10 @@ static int isis_print (const u_int8_t *p, u_int length)
        case TLV_RESTART_SIGNALING:
             if (!TTEST2(*tptr, 3))
                 goto trunctlv;
-           rr = ISIS_MASK_TLV_RESTART_RR(*tptr);
-           ra = ISIS_MASK_TLV_RESTART_RA(*tptr);
-           tptr++;
-           time_remain = EXTRACT_16BITS(tptr);
-           printf("\n\t      Restart Request bit %s, Restart Acknowledgement bit %s\n\t      Remaining holding time: %us",
-                  rr ? "set" : "clear", ra ? "set" : "clear", time_remain);
+            printf("\n\t      Flags [%s], Remaining holding time %us",
+                   bittok2str(isis_restart_flag_values, "none", *tptr),
+                   EXTRACT_16BITS(tptr+1));
+           tptr+=3;
            break;
 
         case TLV_IDRP_INFO:
@@ -1996,7 +1912,7 @@ static int isis_print (const u_int8_t *p, u_int length)
             while (tmp >= SYSTEM_ID_LEN) {
                 if (!TTEST2(*tptr, SYSTEM_ID_LEN))
                     goto trunctlv;
-                printf("\n\t      %s",isis_print_sysid(tptr,SYSTEM_ID_LEN));
+                printf("\n\t      %s",isis_print_id(tptr,SYSTEM_ID_LEN));
                 tptr+=SYSTEM_ID_LEN;
                 tmp-=SYSTEM_ID_LEN;
             }