X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/8f94d68a09e1103353cc7d1133d6dfdf7d5a920d..bdd6be1239614cf13b51aa0c893245ad2a0e2929:/print-isoclns.c diff --git a/print-isoclns.c b/print-isoclns.c index ab5135cc..f610fd32 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.84 2003-05-22 16:52:37 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; @@ -454,14 +446,17 @@ print_nsap(register const u_int8_t *pptr, register int nsap_length) char *junk_buf = nsap_ascii_output; if (nsap_length < 1 || nsap_length > 20) { - sprintf(junk_buf, "illegal length"); + 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)) { @@ -699,21 +694,21 @@ 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++) { - sprintf(pos, "%02x", *cp++); + snprintf(pos, sizeof(id) - (pos - id), "%02x", *cp++); pos += strlen(pos); if (i == 2 || i == 4) *pos++ = '.'; } - if (id_len == NODE_ID_LEN) { - sprintf(pos, ".%02x", *cp++); + if (id_len >= NODE_ID_LEN) { + snprintf(pos, sizeof(id) - (pos - id), ".%02x", *cp++); pos += strlen(pos); } if (id_len == LSP_ID_LEN) - sprintf(pos, "-%02x", *cp); + snprintf(pos, sizeof(id) - (pos - id), "-%02x", *cp); return (id); } @@ -750,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); @@ -809,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; @@ -824,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; @@ -835,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); @@ -859,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; + case SUBTLV_EXT_IS_REACH_RESERVABLE_BW: 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; - 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; } @@ -1210,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 - @@ -1286,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, @@ -1306,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 */ @@ -1334,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); @@ -1369,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) { @@ -1482,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)) @@ -1554,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; } @@ -1836,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)) @@ -1909,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: