]> 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 4ceebcc0f8ba1df9ed8ae6f1c8a880a27fa514dd..f610fd323a28122d1a20028b9a1a092dcf3915d9 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.94 2003-08-13 02:26:52 itojun 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
@@ -110,7 +110,7 @@ static struct tok isis_pdu_values[] = {
 #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
@@ -120,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 */
@@ -155,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"},
@@ -172,30 +172,30 @@ 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_ID,          "Link Local Identifier" },
+    { 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" },
@@ -694,7 +694,7 @@ static char *
 isis_print_id(const u_int8_t *cp, int id_len)
 {
     int i;
-    static char id[21];
+    static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
     char *pos = id;
 
     for (i = 1; i <= SYSTEM_ID_LEN; i++) {
@@ -745,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);
@@ -805,7 +805,7 @@ 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",
+       printf("%s%s subTLV #%u, length: %u",
               ident,
                tok2str(isis_ext_ip_reach_subtlv_values,
                        "unknown",
@@ -856,14 +856,14 @@ 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",
+       printf("%s%s subTLV #%u, length: %u",
               ident,
                tok2str(isis_ext_is_reach_subtlv_values,
                        "unknown",
@@ -876,9 +876,11 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
 
         switch(subt) {
         case SUBTLV_EXT_IS_REACH_ADMIN_GROUP:      
-        case SUBTLV_EXT_IS_REACH_LINK_LOCAL_ID:
+        case SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
         case SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
             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:
@@ -890,12 +892,13 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
             printf(", %.3f Mbps", bw.f*8/1000000 );
             break;
         case SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
-            for (i = 0; i < 8; i++) {
+            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:
@@ -912,13 +915,15 @@ isis_print_is_reach_subtlv (const u_int8_t *tptr,int subt,int subl,const char *i
                    tok2str(gmpls_switch_cap_values, "Unknown", *(tptr)));
             printf(", LSP Encoding: %s",
                    tok2str(gmpls_encoding_values, "Unknown", *(tptr+1)));
+           tptr+=4;
             printf("%s  Max LSP Bandwidth:",ident);
-            for (i = 0; i < 8; i++) {
+            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
@@ -1224,7 +1229,10 @@ static int isis_print (const u_int8_t *p, u_int length)
 
        case L1_LAN_IIH:
        case L2_LAN_IIH:
-           printf(", source-id %s", isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN));
+           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));
@@ -1254,7 +1262,10 @@ static int isis_print (const u_int8_t *p, u_int length)
     /* ok they seem to want to know everything - lets fully decode it */
     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,
@@ -1263,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 */
@@ -1291,14 +1296,14 @@ 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]",
+       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",
+       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);
@@ -1326,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",
+       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) {
@@ -1439,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_id(header_psnp->source_id, NODE_ID_LEN));
+       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))
@@ -1511,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_id(tptr,ETHER_ADDR_LEN));
+                printf("\n\t      SNPA: %s",isis_print_id(tptr,ETHER_ADDR_LEN));
                 tmp -= ETHER_ADDR_LEN;
                 tptr += ETHER_ADDR_LEN;
            }
@@ -1793,7 +1801,7 @@ static int isis_print (const u_int8_t *p, u_int length)
 
            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))