+ /*
+ * We assume the type was supposed to be one of the MPLS
+ * Pseudowire Types.
+ */
+ TLV_TCHECK(7);
+ vc_info_len = GET_U_1(tptr + 2);
+
+ /*
+ * According to RFC 4908, the VC info Length field can be zero,
+ * in which case not only are there no interface parameters,
+ * there's no VC ID.
+ */
+ if (vc_info_len == 0) {
+ ND_PRINT(": %s, %scontrol word, group-ID %u, VC-info-length: %u",
+ tok2str(mpls_pw_types_values, "Unknown", GET_BE_U_2(tptr)&0x7fff),
+ GET_BE_U_2(tptr)&0x8000 ? "" : "no ",
+ GET_BE_U_4(tptr + 3),
+ vc_info_len);
+ break;
+ }
+
+ /* Make sure we have the VC ID as well */
+ TLV_TCHECK(11);
+ ND_PRINT(": %s, %scontrol word, group-ID %u, VC-ID %u, VC-info-length: %u",
+ tok2str(mpls_pw_types_values, "Unknown", GET_BE_U_2(tptr)&0x7fff),
+ GET_BE_U_2(tptr)&0x8000 ? "" : "no ",
+ GET_BE_U_4(tptr + 3),
+ GET_BE_U_4(tptr + 7),
+ vc_info_len);
+ if (vc_info_len < 4) {
+ /* minimum 4, for the VC ID */
+ ND_PRINT(" (invalid, < 4");
+ return(tlv_len+4); /* Type & Length fields not included */
+ }
+ vc_info_len -= 4; /* subtract out the VC ID, giving the length of the interface parameters */
+
+ /* Skip past the fixed information and the VC ID */
+ tptr+=11;
+ tlv_tlen-=11;
+ TLV_TCHECK(vc_info_len);
+
+ while (vc_info_len > 2) {
+ vc_info_tlv_type = GET_U_1(tptr);
+ vc_info_tlv_len = GET_U_1(tptr + 1);
+ if (vc_info_tlv_len < 2)
+ break;
+ if (vc_info_len < vc_info_tlv_len)
+ break;
+
+ ND_PRINT("\n\t\tInterface Parameter: %s (0x%02x), len %u",
+ tok2str(ldp_fec_martini_ifparm_values,"Unknown",vc_info_tlv_type),
+ vc_info_tlv_type,
+ vc_info_tlv_len);
+
+ switch(vc_info_tlv_type) {
+ case LDP_FEC_MARTINI_IFPARM_MTU:
+ ND_PRINT(": %u", GET_BE_U_2(tptr + 2));
+ break;
+
+ case LDP_FEC_MARTINI_IFPARM_DESC:
+ ND_PRINT(": ");
+ for (idx = 2; idx < vc_info_tlv_len; idx++)
+ fn_print_char(ndo, GET_U_1(tptr + idx));
+ break;
+
+ case LDP_FEC_MARTINI_IFPARM_VCCV:
+ ND_PRINT("\n\t\t Control Channels (0x%02x) = [%s]",
+ GET_U_1((tptr + 2)),
+ bittok2str(ldp_fec_martini_ifparm_vccv_cc_values, "none", GET_U_1((tptr + 2))));
+ ND_PRINT("\n\t\t CV Types (0x%02x) = [%s]",
+ GET_U_1((tptr + 3)),
+ bittok2str(ldp_fec_martini_ifparm_vccv_cv_values, "none", GET_U_1((tptr + 3))));
+ break;
+
+ default:
+ print_unknown_data(ndo, tptr+2, "\n\t\t ", vc_info_tlv_len-2);
+ break;
+ }
+
+ vc_info_len -= vc_info_tlv_len;
+ tptr += vc_info_tlv_len;
+ }