+ if (tlv_remaining < 2) {
+ ND_PRINT((ndo, "%sRemaining data in TLV shorter than a subTLV header",ident));
+ proc_bytes += tlv_remaining;
+ break;
+ }
+ if (subtlv_sum_len < 2) {
+ ND_PRINT((ndo, "%sRemaining data in subTLVs shorter than a subTLV header",ident));
+ proc_bytes += subtlv_sum_len;
+ break;
+ }
+ subtlv_type=EXTRACT_U_1(tptr);
+ subtlv_len=EXTRACT_U_1(tptr + 1);
+ tptr += 2;
+ tlv_remaining -= 2;
+ subtlv_sum_len -= 2;
+ proc_bytes += 2;
+ ND_PRINT((ndo, "%s%s subTLV #%u, length: %u",
+ ident, tok2str(isis_ext_is_reach_subtlv_values, "unknown", subtlv_type),
+ subtlv_type, subtlv_len));
+
+ if (subtlv_sum_len < subtlv_len) {
+ ND_PRINT((ndo, " (remaining data in subTLVs shorter than the current subTLV)"));
+ proc_bytes += subtlv_sum_len;
+ break;
+ }
+
+ if (tlv_remaining < subtlv_len) {
+ ND_PRINT((ndo, " (> remaining tlv length)"));
+ proc_bytes += tlv_remaining;
+ break;
+ }
+
+ ND_TCHECK_LEN(tptr, subtlv_len);
+
+ switch(subtlv_type) {
+ case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP:
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID:
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID:
+ if (subtlv_len >= 4) {
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr)));
+ if (subtlv_len == 8) /* rfc4205 */
+ ND_PRINT((ndo, ", 0x%08x", EXTRACT_BE_U_4(tptr + 4)));
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR:
+ case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR:
+ if (subtlv_len >= sizeof(struct in_addr))
+ ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr)));
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
+ case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
+ if (subtlv_len >= 4) {
+ bw.i = EXTRACT_BE_U_4(tptr);
+ ND_PRINT((ndo, ", %.3f Mbps", bw.f * 8 / 1000000));
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
+ if (subtlv_len >= 32) {
+ for (te_class = 0; te_class < 8; te_class++) {
+ bw.i = EXTRACT_BE_U_4(tptr);
+ ND_PRINT((ndo, "%s TE-Class %u: %.3f Mbps",
+ ident,
+ te_class,
+ bw.f * 8 / 1000000));
+ tptr += 4;
+ subtlv_len -= 4;
+ subtlv_sum_len -= 4;
+ proc_bytes += 4;
+ }
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS: /* fall through */
+ case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD:
+ if (subtlv_len == 0)
+ break;
+ ND_PRINT((ndo, "%sBandwidth Constraints Model ID: %s (%u)",
+ ident,
+ tok2str(diffserv_te_bc_values, "unknown", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr)));
+ tptr++;
+ subtlv_len--;
+ subtlv_sum_len--;
+ proc_bytes++;
+ /* decode BCs until the subTLV ends */
+ for (te_class = 0; subtlv_len != 0; te_class++) {
+ if (subtlv_len < 4)
+ break;
+ bw.i = EXTRACT_BE_U_4(tptr);
+ ND_PRINT((ndo, "%s Bandwidth constraint CT%u: %.3f Mbps",
+ ident,
+ te_class,
+ bw.f * 8 / 1000000));
+ tptr += 4;
+ subtlv_len -= 4;
+ subtlv_sum_len -= 4;
+ proc_bytes += 4;
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC:
+ if (subtlv_len >= 3)
+ ND_PRINT((ndo, ", %u", EXTRACT_BE_U_3(tptr)));
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE:
+ if (subtlv_len == 2) {
+ ND_PRINT((ndo, ", [ %s ] (0x%04x)",
+ bittok2str(isis_subtlv_link_attribute_values,
+ "Unknown",
+ EXTRACT_BE_U_2(tptr)),
+ EXTRACT_BE_U_2(tptr)));
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
+ if (subtlv_len >= 2) {
+ ND_PRINT((ndo, ", %s, Priority %u",
+ bittok2str(gmpls_link_prot_values, "none", EXTRACT_U_1(tptr)),
+ EXTRACT_U_1(tptr + 1)));
+ }
+ break;
+ case ISIS_SUBTLV_SPB_METRIC:
+ if (subtlv_len >= 6) {
+ ND_PRINT((ndo, ", LM: %u", EXTRACT_BE_U_3(tptr)));
+ tptr += 3;
+ subtlv_len -= 3;
+ subtlv_sum_len -= 3;
+ proc_bytes += 3;
+ ND_PRINT((ndo, ", P: %u", EXTRACT_U_1(tptr)));
+ tptr++;
+ subtlv_len--;
+ subtlv_sum_len--;
+ proc_bytes++;
+ ND_PRINT((ndo, ", P-ID: %u", EXTRACT_BE_U_2(tptr)));
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
+ if (subtlv_len >= 36) {
+ gmpls_switch_cap = EXTRACT_U_1(tptr);
+ ND_PRINT((ndo, "%s Interface Switching Capability:%s",
+ ident,
+ tok2str(gmpls_switch_cap_values, "Unknown", gmpls_switch_cap)));
+ ND_PRINT((ndo, ", LSP Encoding: %s",
+ tok2str(gmpls_encoding_values, "Unknown", EXTRACT_U_1((tptr + 1)))));
+ tptr += 4;
+ subtlv_len -= 4;
+ subtlv_sum_len -= 4;
+ proc_bytes += 4;
+ ND_PRINT((ndo, "%s Max LSP Bandwidth:", ident));
+ for (priority_level = 0; priority_level < 8; priority_level++) {
+ bw.i = EXTRACT_BE_U_4(tptr);
+ ND_PRINT((ndo, "%s priority level %u: %.3f Mbps",
+ ident,
+ priority_level,
+ bw.f * 8 / 1000000));
+ tptr += 4;
+ subtlv_len -= 4;
+ subtlv_sum_len -= 4;
+ proc_bytes += 4;
+ }
+ switch (gmpls_switch_cap) {
+ case GMPLS_PSC1:
+ case GMPLS_PSC2:
+ case GMPLS_PSC3:
+ case GMPLS_PSC4:
+ if (subtlv_len < 6)
+ break;
+ bw.i = EXTRACT_BE_U_4(tptr);
+ ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000));
+ ND_PRINT((ndo, "%s Interface MTU: %u", ident, EXTRACT_BE_U_2(tptr + 4)));
+ break;
+ case GMPLS_TSC:
+ if (subtlv_len < 8)
+ break;
+ bw.i = EXTRACT_BE_U_4(tptr);
+ ND_PRINT((ndo, "%s Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000));
+ ND_PRINT((ndo, "%s Indication %s", ident,
+ tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", EXTRACT_U_1((tptr + 4)))));
+ break;
+ default:
+ /* there is some optional stuff left to decode but this is as of yet
+ not specified so just lets hexdump what is left */
+ if (subtlv_len != 0) {
+ if (!print_unknown_data(ndo, tptr, "\n\t\t ", subtlv_len))
+ return(0);
+ }
+ }
+ }
+ break;
+ default:
+ if (!print_unknown_data(ndo, tptr, "\n\t\t ", subtlv_len))
+ return(0);
+ break;
+ }
+
+ tptr += subtlv_len;
+ tlv_remaining -= subtlv_len;
+ subtlv_sum_len -= subtlv_len;
+ proc_bytes += subtlv_len;