summaryrefslogtreecommitdiffstats
path: root/pceplib
diff options
context:
space:
mode:
authorJavier Garcia <javier.garcia@voltanet.io>2021-05-21 09:07:41 +0200
committerJavier Garcia <javier.garcia@voltanet.io>2021-06-22 12:04:03 +0200
commit5fe7f5b4798c548dbbc62865c08ee4be4d67e119 (patch)
treea7f28be3392d84f141f92b60f0e579a8a107bc55 /pceplib
parentMerge pull request #8841 from volta-networks/fix_ospf6_bad_seqnum (diff)
downloadfrr-5fe7f5b4798c548dbbc62865c08ee4be4d67e119.tar.xz
frr-5fe7f5b4798c548dbbc62865c08ee4be4d67e119.zip
pceplib: Extract fields needed for PcInitiated with Cisco pce. (1/4)
1.- Unknown/non-standard tlv where cisco sends BSID. 2.- Non-standard Vendor Info object where cisco sends color. Co-authored-by: Javier Garcia <javier.garcia@voltanet.io> Signed-off-by: Sebastien Merle <sebastien@netdef.org> Signed-off-by: Javier Garcia <javier.garcia@voltanet.io>
Diffstat (limited to 'pceplib')
-rw-r--r--pceplib/pcep_msg_objects.h5
-rw-r--r--pceplib/pcep_msg_objects_encoding.c7
-rw-r--r--pceplib/pcep_msg_tlvs.h16
-rw-r--r--pceplib/pcep_msg_tlvs_encoding.c10
-rw-r--r--pceplib/test/pcep_msg_tools_test.c4
5 files changed, 32 insertions, 10 deletions
diff --git a/pceplib/pcep_msg_objects.h b/pceplib/pcep_msg_objects.h
index 959a6f8cf..f26618e29 100644
--- a/pceplib/pcep_msg_objects.h
+++ b/pceplib/pcep_msg_objects.h
@@ -385,11 +385,16 @@ struct pcep_object_lsp {
bool flag_c;
};
+#define ENTERPRISE_NUMBER_CISCO 9
+#define ENTERPRISE_COLOR_CISCO 65540
/* RFC 7470 */
struct pcep_object_vendor_info {
struct pcep_object_header header;
uint32_t enterprise_number;
uint32_t enterprise_specific_info;
+ uint32_t enterprise_specific_info1; /* cisco sends color for PcInit */
+ uint32_t enterprise_specific_info2;
+ uint32_t enterprise_specific_info3;
};
/* RFC 8282 */
diff --git a/pceplib/pcep_msg_objects_encoding.c b/pceplib/pcep_msg_objects_encoding.c
index 9ab96f7bc..69420f8e7 100644
--- a/pceplib/pcep_msg_objects_encoding.c
+++ b/pceplib/pcep_msg_objects_encoding.c
@@ -1339,8 +1339,15 @@ pcep_decode_obj_vendor_info(struct pcep_object_header *hdr,
struct pcep_object_vendor_info *obj =
(struct pcep_object_vendor_info *)common_object_create(
hdr, sizeof(struct pcep_object_vendor_info));
+
obj->enterprise_number = ntohl(*((uint32_t *)(obj_buf)));
obj->enterprise_specific_info = ntohl(*((uint32_t *)(obj_buf + 4)));
+ if (obj->enterprise_number == ENTERPRISE_NUMBER_CISCO
+ && obj->enterprise_specific_info == ENTERPRISE_COLOR_CISCO)
+ obj->enterprise_specific_info1 =
+ ntohl(*((uint32_t *)(obj_buf + 8)));
+ else
+ obj->enterprise_specific_info1 = 0;
return (struct pcep_object_header *)obj;
}
diff --git a/pceplib/pcep_msg_tlvs.h b/pceplib/pcep_msg_tlvs.h
index 5197201e4..6dd2b5655 100644
--- a/pceplib/pcep_msg_tlvs.h
+++ b/pceplib/pcep_msg_tlvs.h
@@ -53,16 +53,16 @@ extern "C" {
* https://www.iana.org/assignments/pcep/pcep.xhtml */
enum pcep_object_tlv_types {
PCEP_OBJ_TLV_TYPE_NO_PATH_VECTOR = 1,
- PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST = 4, /* RFC 5541 */
+ PCEP_OBJ_TLV_TYPE_OBJECTIVE_FUNCTION_LIST = 4, /* RFC 5541 */
PCEP_OBJ_TLV_TYPE_VENDOR_INFO = 7, /* RFC 7470 */
PCEP_OBJ_TLV_TYPE_STATEFUL_PCE_CAPABILITY = 16, /* RFC 8231 */
- PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME = 17, /* RFC 8232 */
- PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS = 18, /* RFC 8231 */
- PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS = 19, /* RFC 8231 */
+ PCEP_OBJ_TLV_TYPE_SYMBOLIC_PATH_NAME = 17, /* RFC 8232 */
+ PCEP_OBJ_TLV_TYPE_IPV4_LSP_IDENTIFIERS = 18, /* RFC 8231 */
+ PCEP_OBJ_TLV_TYPE_IPV6_LSP_IDENTIFIERS = 19, /* RFC 8231 */
PCEP_OBJ_TLV_TYPE_LSP_ERROR_CODE = 20, /* RFC 8232 */
PCEP_OBJ_TLV_TYPE_RSVP_ERROR_SPEC = 21, /* RFC 8232 */
PCEP_OBJ_TLV_TYPE_LSP_DB_VERSION = 23, /* RFC 8232 */
- PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID = 24, /* RFC 8232 */
+ PCEP_OBJ_TLV_TYPE_SPEAKER_ENTITY_ID = 24, /* RFC 8232 */
PCEP_OBJ_TLV_TYPE_SR_PCE_CAPABILITY =
26, /* draft-ietf-pce-segment-routing-16 */
PCEP_OBJ_TLV_TYPE_PATH_SETUP_TYPE = 28, /* RFC 8408 */
@@ -77,10 +77,12 @@ enum pcep_object_tlv_types {
PCEP_OBJ_TLV_TYPE_SRPOLICY_CPATH_PREFERENCE =
63, /*TDB5 draft-barth-pce-segment-routing-policy-cp-04 */
PCEP_OBJ_TLV_TYPE_UNKNOWN = 128,
- PCEP_OBJ_TLV_TYPE_ARBITRARY =
- 65533 /* Max IANA To write arbitrary data */
+ PCEP_OBJ_TYPE_CISCO_BSID = 65505,
+ /* Max IANA To write arbitrary data */
+ PCEP_OBJ_TLV_TYPE_ARBITRARY = 65533
};
+
struct pcep_object_tlv_header {
enum pcep_object_tlv_types type;
/* Pointer into encoded_message field from the pcep_message */
diff --git a/pceplib/pcep_msg_tlvs_encoding.c b/pceplib/pcep_msg_tlvs_encoding.c
index 37f3353f7..d59c97c9d 100644
--- a/pceplib/pcep_msg_tlvs_encoding.c
+++ b/pceplib/pcep_msg_tlvs_encoding.c
@@ -838,7 +838,15 @@ struct pcep_object_tlv_header *pcep_decode_tlv(const uint8_t *tlv_buf)
return NULL;
}
- tlv_decoder_funcptr tlv_decoder = tlv_decoders[tlv_hdr.type];
+ tlv_decoder_funcptr tlv_decoder = NULL;
+ if (tlv_hdr.type == PCEP_OBJ_TYPE_CISCO_BSID) {
+ pcep_log(LOG_INFO,
+ "%s: Cisco BSID TLV decoder found for TLV type [%d]",
+ __func__, tlv_hdr.type);
+ tlv_decoder = tlv_decoders[PCEP_OBJ_TLV_TYPE_ARBITRARY];
+ } else {
+ tlv_decoder = tlv_decoders[tlv_hdr.type];
+ }
if (tlv_decoder == NULL) {
pcep_log(LOG_INFO, "%s: No TLV decoder found for TLV type [%d]",
__func__, tlv_hdr.type);
diff --git a/pceplib/test/pcep_msg_tools_test.c b/pceplib/test/pcep_msg_tools_test.c
index 5a7644b21..e25ddb217 100644
--- a/pceplib/test/pcep_msg_tools_test.c
+++ b/pceplib/test/pcep_msg_tools_test.c
@@ -809,8 +809,8 @@ void test_pcep_msg_read_pcep_report_cisco_pcc()
CU_ASSERT_EQUAL(lsp->header.object_type, PCEP_OBJ_TYPE_LSP);
CU_ASSERT_EQUAL(lsp->header.encoded_object_length, 60);
CU_ASSERT_PTR_NOT_NULL(lsp->header.tlv_list);
- /* The TLV with ID 65505 is not recognized, and its not in the list */
- CU_ASSERT_EQUAL(lsp->header.tlv_list->num_entries, 2);
+ /* The TLV with ID 65505 is now recognized, and its in the list */
+ CU_ASSERT_EQUAL(lsp->header.tlv_list->num_entries, 3);
CU_ASSERT_EQUAL(lsp->plsp_id, 524303);
CU_ASSERT_EQUAL(lsp->operational_status, PCEP_LSP_OPERATIONAL_DOWN);
CU_ASSERT_TRUE(lsp->flag_a);