X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/9d046ee0503d4c8cbfcb200c88986de876f6cae7..5ef0bcb5edd748de9d9af13c40da0395dfdd94e8:/print-isoclns.c diff --git a/print-isoclns.c b/print-isoclns.c index 166cead0..44d1aa73 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -348,6 +348,19 @@ static const struct tok isis_tlv_router_capability_flags[] = { { 0, NULL } }; +#define ISIS_SUBTLV_ROUTER_CAP_SR 2 /* rfc 8667 */ + +static const struct tok isis_router_capability_subtlv_values[] = { + { ISIS_SUBTLV_ROUTER_CAP_SR, "SR-Capabilities"}, + { 0, NULL } +}; + +static const struct tok isis_router_capability_sr_flags[] = { + { 0x80, "ipv4"}, + { 0x40, "ipv6"}, + { 0, NULL } +}; + #define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* rfc5305 */ #define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* rfc4205 */ #define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* rfc5305 */ @@ -362,6 +375,7 @@ static const struct tok isis_tlv_router_capability_flags[] = { #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* rfc4205 */ #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* rfc4205 */ #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */ +#define ISIS_SUBTLV_EXT_IS_REACH_LAN_ADJ_SEGMENT_ID 32 /* rfc8667 */ #define ISIS_SUBTLV_SPB_METRIC 29 /* rfc6329 */ @@ -380,6 +394,7 @@ static const struct tok isis_ext_is_reach_subtlv_values[] = { { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR, "Interface Switching Capability" }, { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD, "Bandwidth Constraints (old)" }, { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS, "Bandwidth Constraints" }, + { ISIS_SUBTLV_EXT_IS_REACH_LAN_ADJ_SEGMENT_ID, "LAN Adjacency Segment Identifier" }, { ISIS_SUBTLV_SPB_METRIC, "SPB Metric" }, { 250, "Reserved for cisco specific extensions" }, { 251, "Reserved for cisco specific extensions" }, @@ -392,15 +407,42 @@ static const struct tok isis_ext_is_reach_subtlv_values[] = { #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */ #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */ +#define ISIS_SUBTLV_EXTD_IP_REACH_PREFIX_SID 3 /* rfc8667 */ #define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */ static const struct tok isis_ext_ip_reach_subtlv_values[] = { { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32, "32-Bit Administrative tag" }, { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64, "64-Bit Administrative tag" }, + { ISIS_SUBTLV_EXTD_IP_REACH_PREFIX_SID, "Prefix SID" }, { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR, "Management Prefix Color" }, { 0, NULL } }; +#define ISIS_PREFIX_SID_FLAG_R 0x80 /* rfc 8667 */ +#define ISIS_PREFIX_SID_FLAG_N 0x40 /* rfc 8667 */ +#define ISIS_PREFIX_SID_FLAG_P 0x20 /* rfc 8667 */ +#define ISIS_PREFIX_SID_FLAG_E 0x10 /* rfc 8667 */ +#define ISIS_PREFIX_SID_FLAG_V 0x08 /* rfc 8667 */ +#define ISIS_PREFIX_SID_FLAG_L 0x04 /* rfc 8667 */ + +static const struct tok prefix_sid_flag_values[] = { + { ISIS_PREFIX_SID_FLAG_R, "Readvertisement"}, + { ISIS_PREFIX_SID_FLAG_N, "Node"}, + { ISIS_PREFIX_SID_FLAG_P, "No-PHP"}, + { ISIS_PREFIX_SID_FLAG_E, "Explicit NULL"}, + { ISIS_PREFIX_SID_FLAG_V, "Value"}, + { ISIS_PREFIX_SID_FLAG_L, "Local"}, + { 0, NULL} +}; + + +/* rfc 8667 */ +static const struct tok prefix_sid_algo_values[] = { + { 0, "SPF"}, + { 1, "strict-SPF"}, + { 0, NULL} +}; + static const struct tok isis_subtlv_link_attribute_values[] = { { 0x01, "Local Protection Available" }, { 0x02, "Link excluded from local protection path" }, @@ -408,6 +450,16 @@ static const struct tok isis_subtlv_link_attribute_values[] = { { 0, NULL } }; +static const struct tok isis_lan_adj_sid_flag_values[] = { + { 0x80, "Address family IPv6" }, + { 0x40, "Backup" }, + { 0x20, "Value" }, + { 0x10, "Local significance" }, + { 0x08, "Set of adjacencies" }, + { 0x04, "Persistent" }, + { 0, NULL } +}; + #define ISIS_SUBTLV_AUTH_SIMPLE 1 #define ISIS_SUBTLV_AUTH_GENERIC 3 /* rfc 5310 */ #define ISIS_SUBTLV_AUTH_MD5 54 @@ -683,7 +735,6 @@ void isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) { ndo->ndo_protocol = "isoclns"; - ND_TCHECK_1(p); /* enough bytes on the wire ? */ if (ndo->ndo_eflag) ND_PRINT("OSI NLPID %s (0x%02x): ", @@ -734,9 +785,6 @@ isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) print_unknown_data(ndo, p, "\n\t", length); break; } - return; -trunc: - nd_print_trunc(ndo); } #define CLNP_PDU_ER 1 @@ -832,7 +880,6 @@ clnp_print(netdissect_options *ndo, ND_PRINT("li < size of fixed part of CLNP header and addresses"); return (0); } - ND_TCHECK_1(pptr); dest_address_length = GET_U_1(pptr); pptr += 1; li_remaining -= 1; @@ -849,7 +896,6 @@ clnp_print(netdissect_options *ndo, ND_PRINT("li < size of fixed part of CLNP header and addresses"); return (0); } - ND_TCHECK_1(pptr); source_address_length = GET_U_1(pptr); pptr += 1; li_remaining -= 1; @@ -918,7 +964,6 @@ clnp_print(netdissect_options *ndo, ND_PRINT(", bad opts/li"); return (0); } - ND_TCHECK_2(pptr); op = GET_U_1(pptr); opli = GET_U_1(pptr + 1); pptr += 2; @@ -977,8 +1022,6 @@ clnp_print(netdissect_options *ndo, } if (source_address_length > 0) { source_address=(tptr+1); - ND_TCHECK_LEN(source_address, - source_address_length); ND_PRINT("\n\t NSAP address (length %u): %s", source_address_length, GET_ISONSAP_STRING(source_address, source_address_length)); @@ -1057,7 +1100,6 @@ clnp_print(netdissect_options *ndo, case CLNP_PDU_ER: /* fall through */ case CLNP_PDU_ERP: - ND_TCHECK_1(pptr); if (GET_U_1(pptr) == NLPID_CLNP) { ND_PRINT("\n\t-----original packet-----\n\t"); /* FIXME recursion protection */ @@ -1083,9 +1125,9 @@ clnp_print(netdissect_options *ndo, default: /* dump the PDU specific data */ - if (length-(pptr-optr) > 0) { + if (length > ND_BYTES_BETWEEN(pptr, optr)) { ND_PRINT("\n\t undecoded non-header data, length %u", length-li); - print_unknown_data(ndo, pptr, "\n\t ", length - (int)(pptr - optr)); + print_unknown_data(ndo, pptr, "\n\t ", length - ND_BYTES_BETWEEN(pptr, optr)); } } @@ -1330,8 +1372,12 @@ esis_print(netdissect_options *ndo, default: if (ndo->ndo_vflag <= 1) { - if (pptr < ndo->ndo_snapend) - print_unknown_data(ndo, pptr, "\n\t ", (int)(ndo->ndo_snapend - pptr)); + /* + * If there's at least one byte to print, print + * it/them. + */ + if (ND_TTEST_LEN(pptr, 1)) + print_unknown_data(ndo, pptr, "\n\t ", ND_BYTES_AVAILABLE_AFTER(pptr)); } return; } @@ -1345,7 +1391,6 @@ esis_print(netdissect_options *ndo, ND_PRINT(", bad opts/li"); return; } - ND_TCHECK_2(pptr); op = GET_U_1(pptr); opli = GET_U_1(pptr + 1); pptr += 2; @@ -1374,7 +1419,6 @@ esis_print(netdissect_options *ndo, case ESIS_OPTION_PROTOCOLS: while (opli>0) { - ND_TCHECK_1(tptr); ND_PRINT("%s (0x%02x)", tok2str(nlpid_values, "unknown", @@ -1446,7 +1490,6 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo, while (len > 2) { - ND_TCHECK_2(tptr); stlv_type = GET_U_1(tptr); stlv_len = GET_U_1(tptr + 1); @@ -1579,7 +1622,6 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, while (len > 2) { - ND_TCHECK_2(tptr); stlv_type = GET_U_1(tptr); stlv_len = GET_U_1(tptr + 1); tptr += 2; @@ -1672,7 +1714,6 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, stlv_len -= 8; while (stlv_len >= 4) { - ND_TCHECK_4(tptr); ND_PRINT("\n\t T: %u, R: %u, RES: %u, ISID: %u", (GET_BE_U_4(tptr) >> 31), (GET_BE_U_4(tptr) >> 30) & 0x01, @@ -1860,6 +1901,35 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo, subl-=8; } break; + case ISIS_SUBTLV_EXTD_IP_REACH_PREFIX_SID: + { + uint8_t algo, flags; + uint32_t sid; + + flags = GET_U_1(tptr); + algo = GET_U_1(tptr+1); + + if (flags & ISIS_PREFIX_SID_FLAG_V) { + if (subl < 5) + goto trunc; + sid = GET_BE_U_3(tptr+2); + tptr+=5; + subl-=5; + } else { + if (subl < 6) + goto trunc; + sid = GET_BE_U_4(tptr+2); + tptr+=6; + subl-=6; + } + + ND_PRINT(", Flags [%s], Algo %s (%u), %s %u", + bittok2str(prefix_sid_flag_values, "None", flags), + tok2str(prefix_sid_algo_values, "Unknown", algo), algo, + flags & ISIS_PREFIX_SID_FLAG_V ? "label" : "index", + sid); + } + break; default: if (!print_unknown_data(ndo, tptr, "\n\t\t ", subl)) return(0); @@ -2112,6 +2182,41 @@ isis_print_ext_is_reach(netdissect_options *ndo, } } break; + case ISIS_SUBTLV_EXT_IS_REACH_LAN_ADJ_SEGMENT_ID: + if (subtlv_len >= 8) { + ND_PRINT("%s Flags: [%s]", ident, + bittok2str(isis_lan_adj_sid_flag_values, + "none", + GET_U_1(tptr))); + int vflag = (GET_U_1(tptr) & 0x20) ? 1:0; + int lflag = (GET_U_1(tptr) & 0x10) ? 1:0; + tptr++; + subtlv_len--; + subtlv_sum_len--; + proc_bytes++; + ND_PRINT("%s Weight: %u", ident, GET_U_1(tptr)); + tptr++; + subtlv_len--; + subtlv_sum_len--; + proc_bytes++; + if(subtlv_len>=SYSTEM_ID_LEN) { + ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN); + ND_PRINT("%s Neighbor System-ID: %s", ident, + isis_print_id(ndo, tptr, SYSTEM_ID_LEN)); + } + /* RFC 8667 section 2.2.2 */ + /* if V-flag is set to 1 and L-flag is set to 1 ==> 3 octet label */ + /* if V-flag is set to 0 and L-flag is set to 0 ==> 4 octet index */ + if (vflag && lflag) { + ND_PRINT("%s Label: %u", + ident, GET_BE_U_3(tptr+SYSTEM_ID_LEN)); + } else if ((!vflag) && (!lflag)) { + ND_PRINT("%s Index: %u", + ident, GET_BE_U_4(tptr+SYSTEM_ID_LEN)); + } else + nd_print_invalid(ndo); + } + break; default: if (!print_unknown_data(ndo, tptr, "\n\t\t ", subtlv_len)) return(0); @@ -2141,7 +2246,6 @@ isis_print_mtid(netdissect_options *ndo, { if (tlv_remaining < 2) goto trunc; - ND_TCHECK_2(tptr); ND_PRINT("%s%s", ident, @@ -2173,13 +2277,11 @@ isis_print_extd_ip_reach(netdissect_options *ndo, uint8_t prefix[sizeof(nd_ipv6)]; /* shared copy buffer for IPv4 and IPv6 prefixes */ u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen; - ND_TCHECK_4(tptr); metric = GET_BE_U_4(tptr); processed=4; tptr+=4; if (afi == AF_INET) { - ND_TCHECK_1(tptr); status_byte=GET_U_1(tptr); tptr++; bit_length = status_byte&0x3f; @@ -2191,7 +2293,6 @@ isis_print_extd_ip_reach(netdissect_options *ndo, } processed++; } else if (afi == AF_INET6) { - ND_TCHECK_2(tptr); status_byte=GET_U_1(tptr); bit_length=GET_U_1(tptr + 1); if (bit_length > 128) { @@ -2242,14 +2343,12 @@ isis_print_extd_ip_reach(netdissect_options *ndo, than one subTLV - therefore the first byte must reflect the aggregate bytecount of the subTLVs for this prefix */ - ND_TCHECK_1(tptr); sublen=GET_U_1(tptr); tptr++; processed+=sublen+1; ND_PRINT(" (%u)", sublen); /* print out subTLV length */ while (sublen>0) { - ND_TCHECK_2(tptr); subtlvtype=GET_U_1(tptr); subtlvlen=GET_U_1(tptr + 1); tptr+=2; @@ -2266,6 +2365,89 @@ trunc: return 0; } +static void +isis_print_router_cap_subtlv(netdissect_options *ndo, const uint8_t *tptr, uint8_t tlen) +{ + uint8_t subt, subl; + + while (tlen >= 2) { + subt = GET_U_1(tptr); + subl = GET_U_1(tptr+1); + tlen -= 2; + tptr += 2; + + /* first lets see if we know the subTLVs name*/ + ND_PRINT("\n\t\t%s subTLV #%u, length: %u", + tok2str(isis_router_capability_subtlv_values, "unknown", subt), + subt, subl); + + /* + * Boundary check. + */ + if (subl > tlen) { + break; + } + ND_TCHECK_LEN(tptr, subl); + + switch (subt) { + case ISIS_SUBTLV_ROUTER_CAP_SR: + { + uint8_t flags, sid_tlen, sid_type, sid_len; + uint32_t range; + const uint8_t *sid_ptr; + + flags = GET_U_1(tptr); + range = GET_BE_U_3(tptr+1); + ND_PRINT(", Flags [%s], Range %u", + bittok2str(isis_router_capability_sr_flags, "None", flags), + range); + sid_ptr = tptr + 4; + sid_tlen = subl - 4; + + while (sid_tlen >= 5) { + sid_type = GET_U_1(sid_ptr); + sid_len = GET_U_1(sid_ptr+1); + sid_tlen -= 2; + sid_ptr += 2; + + /* + * Boundary check. + */ + if (sid_len > sid_tlen) { + break; + } + + switch (sid_type) { + case 1: + if (sid_len == 3) { + ND_PRINT(", SID value %u", GET_BE_U_3(sid_ptr)); + } else if (sid_len == 4) { + ND_PRINT(", SID value %u", GET_BE_U_4(sid_ptr)); + } else { + ND_PRINT(", Unknown SID length%u", sid_len); + } + break; + default: + print_unknown_data(ndo, sid_ptr, "\n\t\t ", sid_len); + } + + sid_ptr += sid_len; + sid_tlen -= sid_len; + } + } + break; + default: + print_unknown_data(ndo, tptr, "\n\t\t", subl); + break; + } + + tlen -= subl; + tptr += subl; + } + trunc: + return; +} + /* * Clear checksum and lifetime prior to signature verification. */ @@ -2702,13 +2884,11 @@ isis_print(netdissect_options *ndo, switch (tlv_type) { case ISIS_TLV_AREA_ADDR: while (tlen != 0) { - ND_TCHECK_1(tptr); alen = GET_U_1(tptr); tptr++; tlen--; if (tlen < alen) goto tlv_trunc; - ND_TCHECK_LEN(tptr, alen); ND_PRINT("\n\t Area address (length: %u): %s", alen, GET_ISONSAP_STRING(tptr, alen)); @@ -2801,7 +2981,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_IS_REACH: if (tlen < 1) goto tlv_trunc; - ND_TCHECK_1(tptr); /* check if there is one byte left to read out the virtual flag */ ND_PRINT("\n\t %s", tok2str(isis_is_reach_virtual_values, "bogus virtual flag 0x%02x", @@ -2920,8 +3099,6 @@ isis_print(netdissect_options *ndo, while (tlen != 0) { if (tlen < sizeof(nd_ipv6)) goto tlv_trunc; - ND_TCHECK_LEN(tptr, sizeof(nd_ipv6)); - ND_PRINT("\n\t IPv6 interface address: %s", GET_IP6ADDR_STRING(tptr)); @@ -2932,7 +3109,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_AUTH: if (tlen < 1) goto tlv_trunc; - ND_TCHECK_1(tptr); auth_type = GET_U_1(tptr); tptr++; tlen--; @@ -2949,7 +3125,6 @@ isis_print(netdissect_options *ndo, break; case ISIS_SUBTLV_AUTH_MD5: for(i=0;i=1) { - ND_TCHECK_1(tptr); ND_PRINT("\n\t Adjacency State: %s (%u)", tok2str(isis_ptp_adjancey_values, "unknown", GET_U_1(tptr)), GET_U_1(tptr)); tlen--; } if(tlen>sizeof(tlv_ptp_adj->extd_local_circuit_id)) { - ND_TCHECK_4(tlv_ptp_adj->extd_local_circuit_id); ND_PRINT("\n\t Extended Local circuit-ID: 0x%08x", GET_BE_U_4(tlv_ptp_adj->extd_local_circuit_id)); tlen-=sizeof(tlv_ptp_adj->extd_local_circuit_id); @@ -3004,7 +3175,6 @@ isis_print(netdissect_options *ndo, tlen-=SYSTEM_ID_LEN; } if(tlen>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) { - ND_TCHECK_4(tlv_ptp_adj->neighbor_extd_local_circuit_id); ND_PRINT("\n\t Neighbor Extended Local circuit-ID: 0x%08x", GET_BE_U_4(tlv_ptp_adj->neighbor_extd_local_circuit_id)); } @@ -3013,7 +3183,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_PROTOCOLS: ND_PRINT("\n\t NLPID(s): "); while (tlen != 0) { - ND_TCHECK_1(tptr); ND_PRINT("%s (0x%02x)", tok2str(nlpid_values, "unknown", @@ -3030,7 +3199,6 @@ isis_print(netdissect_options *ndo, { if (tlen < 2) goto tlv_trunc; - ND_TCHECK_2(tptr); ND_PRINT("\n\t RES: %u, MTID(s): %u", (GET_BE_U_2(tptr) >> 12), @@ -3048,7 +3216,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_MT_CAPABILITY: if (tlen < 2) goto tlv_trunc; - ND_TCHECK_2(tptr); ND_PRINT("\n\t O: %u, RES: %u, MTID(s): %u", (GET_BE_U_2(tptr) >> 15) & 0x01, @@ -3066,7 +3233,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_TE_ROUTER_ID: if (tlen < sizeof(nd_ipv4)) goto tlv_trunc; - ND_TCHECK_LEN(pptr, sizeof(nd_ipv4)); ND_PRINT("\n\t Traffic Engineering Router ID: %s", GET_IPADDR_STRING(pptr)); break; @@ -3074,7 +3240,6 @@ isis_print(netdissect_options *ndo, while (tlen != 0) { if (tlen < sizeof(nd_ipv4)) goto tlv_trunc; - ND_TCHECK_LEN(tptr, sizeof(nd_ipv4)); ND_PRINT("\n\t IPv4 interface address: %s", GET_IPADDR_STRING(tptr)); tptr += sizeof(nd_ipv4); tlen -= sizeof(nd_ipv4); @@ -3097,7 +3262,6 @@ isis_print(netdissect_options *ndo, if (tlen < 1) break; - ND_TCHECK_1(tptr); ND_PRINT(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(GET_U_1(tptr)) ? "numbered" : "unnumbered"); tptr++; @@ -3105,14 +3269,12 @@ isis_print(netdissect_options *ndo, if (tlen < sizeof(nd_ipv4)) break; - ND_TCHECK_LEN(tptr, sizeof(nd_ipv4)); ND_PRINT("\n\t IPv4 interface address: %s", GET_IPADDR_STRING(tptr)); tptr+=sizeof(nd_ipv4); tlen-=sizeof(nd_ipv4); if (tlen < sizeof(nd_ipv4)) break; - ND_TCHECK_LEN(tptr, sizeof(nd_ipv4)); ND_PRINT("\n\t IPv4 neighbor address: %s", GET_IPADDR_STRING(tptr)); tptr+=sizeof(nd_ipv4); tlen-=sizeof(nd_ipv4); @@ -3120,7 +3282,6 @@ isis_print(netdissect_options *ndo, while (tlen != 0) { if (tlen < 4) goto tlv_trunc; - ND_TCHECK_4(tptr); ND_PRINT("\n\t Link-ID: 0x%08x", GET_BE_U_4(tptr)); tptr+=4; tlen-=4; @@ -3135,13 +3296,10 @@ isis_print(netdissect_options *ndo, ND_TCHECK_1(tlv_lsp->lsp_id + LSP_ID_LEN - 1); ND_PRINT("\n\t lsp-id: %s", isis_print_id(ndo, tlv_lsp->lsp_id, LSP_ID_LEN)); - ND_TCHECK_4(tlv_lsp->sequence_number); ND_PRINT(", seq: 0x%08x", GET_BE_U_4(tlv_lsp->sequence_number)); - ND_TCHECK_2(tlv_lsp->remaining_lifetime); ND_PRINT(", lifetime: %5ds", GET_BE_U_2(tlv_lsp->remaining_lifetime)); - ND_TCHECK_2(tlv_lsp->checksum); ND_PRINT(", chksum: 0x%04x", GET_BE_U_2(tlv_lsp->checksum)); tlen-=sizeof(struct isis_tlv_lsp); tlv_lsp++; @@ -3165,7 +3323,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_POI: if (tlen < 1) goto tlv_trunc; - ND_TCHECK_1(tptr); num_system_ids = GET_U_1(tptr); tptr++; tlen--; @@ -3241,7 +3398,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_IDRP_INFO: if (tlen < 1) break; - ND_TCHECK_1(tptr); isis_subtlv_idrp = GET_U_1(tptr); ND_PRINT("\n\t Inter-Domain Information Type: %s", tok2str(isis_subtlv_idrp_values, @@ -3253,7 +3409,6 @@ isis_print(netdissect_options *ndo, case ISIS_SUBTLV_IDRP_ASN: if (tlen < 2) goto tlv_trunc; - ND_TCHECK_2(tptr); /* fetch AS number */ ND_PRINT("AS Number: %u", GET_BE_U_2(tptr)); break; case ISIS_SUBTLV_IDRP_LOCAL: @@ -3268,7 +3423,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_LSP_BUFFERSIZE: if (tlen < 2) break; - ND_TCHECK_2(tptr); ND_PRINT("\n\t LSP Buffersize: %u", GET_BE_U_2(tptr)); break; @@ -3293,7 +3447,6 @@ isis_print(netdissect_options *ndo, tlen-=sizeof(struct isis_metric_block); while (tlen != 0) { - ND_TCHECK_1(tptr); prefix_len=GET_U_1(tptr); /* read out prefix length in semioctets*/ tptr++; tlen--; @@ -3303,7 +3456,6 @@ isis_print(netdissect_options *ndo, } if (tlen < prefix_len/2) break; - ND_TCHECK_LEN(tptr, prefix_len / 2); ND_PRINT("\n\t\tAddress: %s/%u", GET_ISONSAP_STRING(tptr, prefix_len / 2), prefix_len * 4); tptr+=prefix_len/2; @@ -3314,7 +3466,6 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_IIH_SEQNR: if (tlen < 4) break; - ND_TCHECK_4(tptr); /* check if four bytes are on the wire */ ND_PRINT("\n\t Sequence number: %u", GET_BE_U_4(tptr)); break; @@ -3324,19 +3475,19 @@ isis_print(netdissect_options *ndo, nd_print_invalid(ndo); break; } - ND_TCHECK_5(tptr); /* router-id + flags */ - ND_PRINT("\n\t\tRouter-id: %s", GET_IPADDR_STRING(tptr)); - ND_PRINT("\n\t\tFlags: [%s]", - bittok2str(isis_tlv_router_capability_flags, - "none", - GET_U_1(tptr+4))); - /* FIXME Optional set of sub-TLV */ + ND_PRINT("\n\t Router-ID %s", GET_IPADDR_STRING(tptr)); + ND_PRINT(", Flags [%s]", + bittok2str(isis_tlv_router_capability_flags, "none", GET_U_1(tptr+4))); + + /* Optional set of sub-TLV */ + if (tlen > 5) { + isis_print_router_cap_subtlv(ndo, tptr+5, tlen-5); + } break; case ISIS_TLV_VENDOR_PRIVATE: if (tlen < 3) break; - ND_TCHECK_3(tptr); /* check if enough byte for a full oui */ vendor_id = GET_BE_U_3(tptr); ND_PRINT("\n\t Vendor: %s (%u)", tok2str(oui_values, "Unknown", vendor_id),