From 48d1cd17482fb37f1927734e70c473d03cf6dc5b Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Wed, 22 Feb 2023 01:25:12 +0100 Subject: [PATCH] isisd: Add SRv6 Locator TLV to the LSP Add the SRv6 Locator TLV and its Sub-TLV and Sub-Sub-TLVs to the LSP. Signed-off-by: Carmine Scarpitta --- isisd/isis_lsp.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 07c1404a0f..e5970f6509 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1229,7 +1229,39 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) srv6db->config.max_h_encaps_msd; rcap->srv6_msd.max_end_d_msd = srv6db->config.max_end_d_msd; + } else { + rcap->srv6_cap.is_srv6_capable = false; + } + } + + /* Add SRv6 Locator TLV. */ + if (area->srv6db.config.enabled && + !list_isempty(area->srv6db.srv6_locator_chunks)) { + struct isis_srv6_locator locator = {}; + struct srv6_locator_chunk *chunk; + + /* TODO: support more than one locator */ + chunk = (struct srv6_locator_chunk *)listgetdata( + listhead(area->srv6db.srv6_locator_chunks)); + + locator.metric = 0; + locator.prefix = chunk->prefix; + locator.flags = 0; + locator.algorithm = 0; + + struct listnode *sid_node; + struct isis_srv6_sid *sid; + locator.srv6_sid = list_new(); + for (ALL_LIST_ELEMENTS_RO(area->srv6db.srv6_sids, sid_node, + sid)) { + listnode_add(locator.srv6_sid, sid); } + + isis_tlvs_add_srv6_locator(lsp->tlvs, 0, &locator); + lsp_debug("ISIS (%s): Adding SRv6 Locator information", + area->area_tag); + + list_delete(&locator.srv6_sid); } /* IPv4 address and TE router ID TLVs. -- 2.39.5