+ ND_PRINT(" (%u)", subtlv_sum_len);
+ /* prepend the indent string */
+ snprintf(indent_buffer, sizeof(indent_buffer), "%s ", indent);
+ indent = indent_buffer;
+ while (subtlv_sum_len != 0) {
+ ND_TCHECK_2(tptr);
+ if (tlv_remaining < 2) {
+ ND_PRINT("%sRemaining data in TLV shorter than a subTLV header", indent);
+ proc_bytes += tlv_remaining;
+ break;
+ }
+ if (subtlv_sum_len < 2) {
+ ND_PRINT("%sRemaining data in subTLVs shorter than a subTLV header", indent);
+ proc_bytes += subtlv_sum_len;
+ break;
+ }
+ subtlv_type=GET_U_1(tptr);
+ subtlv_len=GET_U_1(tptr + 1);
+ tptr += 2;
+ tlv_remaining -= 2;
+ subtlv_sum_len -= 2;
+ proc_bytes += 2;
+ ND_PRINT("%s%s subTLV #%u, length: %u",
+ indent, tok2str(isis_ext_is_reach_subtlv_values, "unknown", subtlv_type),
+ subtlv_type, subtlv_len);
+
+ if (subtlv_sum_len < subtlv_len) {
+ ND_PRINT(" (remaining data in subTLVs shorter than the current subTLV)");
+ proc_bytes += subtlv_sum_len;
+ break;
+ }
+
+ if (tlv_remaining < subtlv_len) {
+ ND_PRINT(" (> 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(", 0x%08x", GET_BE_U_4(tptr));
+ if (subtlv_len == 8) /* rfc4205 */
+ ND_PRINT(", 0x%08x", GET_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(nd_ipv4))
+ ND_PRINT(", %s", GET_IPADDR_STRING(tptr));
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
+ case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
+ if (subtlv_len >= 4)
+ ND_PRINT(", %.3f Mbps", GET_BE_F_4(tptr) * 8 / 1000000);
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
+ if (subtlv_len >= 32) {
+ for (te_class = 0; te_class < 8; te_class++) {
+ ND_PRINT("%s TE-Class %u: %.3f Mbps",
+ indent,
+ te_class,
+ GET_BE_F_4(tptr) * 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("%sBandwidth Constraints Model ID: %s (%u)",
+ indent,
+ tok2str(diffserv_te_bc_values, "unknown", GET_U_1(tptr)),
+ GET_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;
+ ND_PRINT("%s Bandwidth constraint CT%u: %.3f Mbps",
+ indent,
+ te_class,
+ GET_BE_F_4(tptr) * 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(", %u", GET_BE_U_3(tptr));
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE:
+ if (subtlv_len == 2) {
+ ND_PRINT(", [ %s ] (0x%04x)",
+ bittok2str(isis_subtlv_link_attribute_values,
+ "Unknown",
+ GET_BE_U_2(tptr)),
+ GET_BE_U_2(tptr));
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE:
+ if (subtlv_len >= 2) {
+ ND_PRINT(", %s, Priority %u",
+ bittok2str(gmpls_link_prot_values, "none", GET_U_1(tptr)),
+ GET_U_1(tptr + 1));
+ }
+ break;
+ case ISIS_SUBTLV_SPB_METRIC:
+ if (subtlv_len >= 6) {
+ ND_PRINT(", LM: %u", GET_BE_U_3(tptr));
+ tptr += 3;
+ subtlv_len -= 3;
+ subtlv_sum_len -= 3;
+ proc_bytes += 3;
+ ND_PRINT(", P: %u", GET_U_1(tptr));
+ tptr++;
+ subtlv_len--;
+ subtlv_sum_len--;
+ proc_bytes++;
+ ND_PRINT(", P-ID: %u", GET_BE_U_2(tptr));
+ }
+ break;
+ case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR:
+ if (subtlv_len >= 36) {
+ gmpls_switch_cap = GET_U_1(tptr);
+ ND_PRINT("%s Interface Switching Capability:%s",
+ indent,
+ tok2str(gmpls_switch_cap_values, "Unknown", gmpls_switch_cap));
+ ND_PRINT(", LSP Encoding: %s",
+ tok2str(gmpls_encoding_values, "Unknown", GET_U_1((tptr + 1))));
+ tptr += 4;
+ subtlv_len -= 4;
+ subtlv_sum_len -= 4;
+ proc_bytes += 4;
+ ND_PRINT("%s Max LSP Bandwidth:", indent);
+ for (priority_level = 0; priority_level < 8; priority_level++) {
+ ND_PRINT("%s priority level %u: %.3f Mbps",
+ indent,
+ priority_level,
+ GET_BE_F_4(tptr) * 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;
+ ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps",
+ indent,
+ GET_BE_F_4(tptr) * 8 / 1000000);
+ ND_PRINT("%s Interface MTU: %u", indent,
+ GET_BE_U_2(tptr + 4));
+ break;
+ case GMPLS_TSC:
+ if (subtlv_len < 8)
+ break;
+ ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", indent,
+ GET_BE_F_4(tptr) * 8 / 1000000);
+ ND_PRINT("%s Indication %s", indent,
+ tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", GET_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;
+ case ISIS_SUBTLV_EXT_IS_REACH_LAN_ADJ_SEGMENT_ID:
+ if (subtlv_len >= 8) {
+ ND_PRINT("%s Flags: [%s]", indent,
+ 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", indent, 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", indent,
+ 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",
+ indent, GET_BE_U_3(tptr+SYSTEM_ID_LEN));
+ } else if ((!vflag) && (!lflag)) {
+ ND_PRINT("%s Index: %u",
+ indent, 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);
+ break;
+ }
+
+ tptr += subtlv_len;
+ tlv_remaining -= subtlv_len;
+ subtlv_sum_len -= subtlv_len;
+ proc_bytes += subtlv_len;