diff options
author | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-03-16 10:24:04 +0100 |
---|---|---|
committer | Carmine Scarpitta <carmine.scarpitta@uniroma2.it> | 2023-09-11 22:11:39 +0200 |
commit | cfc90fc490940752b2e3e2abeeb399942bde1541 (patch) | |
tree | 7a014481476a6989a7844962464c438a2c7f7f1f /isisd | |
parent | isisd: Add func to build Sub-TLV from SRv6 End SID (diff) | |
download | frr-cfc90fc490940752b2e3e2abeeb399942bde1541.tar.xz frr-cfc90fc490940752b2e3e2abeeb399942bde1541.zip |
isisd: Add End SID when building SRv6 Locator TLV
Encode SRv6 End SID Sub-TLVs when building the SRv6 Locator TLV.
Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'isisd')
-rw-r--r-- | isisd/isis_tlvs.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index da6272531..3f56f8336 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -7770,6 +7770,9 @@ void isis_subtlvs_add_srv6_end_sid(struct isis_subtlvs *subtlvs, void isis_tlvs_add_srv6_locator(struct isis_tlvs *tlvs, uint16_t mtid, struct isis_srv6_locator *loc) { + bool subtlvs_present = false; + struct listnode *node; + struct isis_srv6_sid *sid; struct isis_srv6_locator_tlv *loc_tlv = XCALLOC(MTYPE_ISIS_TLV, sizeof(*loc_tlv)); @@ -7777,6 +7780,27 @@ void isis_tlvs_add_srv6_locator(struct isis_tlvs *tlvs, uint16_t mtid, * configuration */ isis_srv6_locator2tlv(loc, loc_tlv); + /* Add the SRv6 End SID Sub-TLVs */ + loc_tlv->subtlvs = isis_alloc_subtlvs(ISIS_CONTEXT_SUBTLV_SRV6_LOCATOR); + for (ALL_LIST_ELEMENTS_RO(loc->srv6_sid, node, sid)) { + if (sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_DT6 || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_DT6_USID || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_DT4 || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_DT4_USID || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_DT46 || + sid->behavior == SRV6_ENDPOINT_BEHAVIOR_END_DT46_USID) { + isis_subtlvs_add_srv6_end_sid(loc_tlv->subtlvs, sid); + subtlvs_present = true; + } + } + + if (!subtlvs_present) { + isis_free_subtlvs(loc_tlv->subtlvs); + loc_tlv->subtlvs = NULL; + } + /* Append the SRv6 Locator TLV to the TLVs list */ struct isis_item_list *l; l = isis_get_mt_items(&tlvs->srv6_locator, mtid); |