From 2e8d254ac71a5bce205616a8d62690a183f54126 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Thu, 2 Feb 2023 12:30:35 +0100 Subject: [PATCH] isisd: Add SRv6 locator chunks to SRv6 config Add a list of SRv6 locator chunks allocated to a specific IS-IS area. The list is initialized when the IS-IS area is created and freed when the IS-IS area is destroyed. Subsequent commits will introduce the possibility to allocate and release locator chunks. Signed-off-by: Carmine Scarpitta --- isisd/isis_srv6.c | 13 +++++++++++++ isisd/isis_srv6.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/isisd/isis_srv6.c b/isisd/isis_srv6.c index 1397ea4d0b..b08609d360 100644 --- a/isisd/isis_srv6.c +++ b/isisd/isis_srv6.c @@ -9,6 +9,7 @@ #include +#include "srv6.h" #include "termtable.h" #include "isisd/isisd.h" @@ -124,6 +125,9 @@ void isis_srv6_area_init(struct isis_area *area) srv6db->config.max_end_pop_msd = SRV6_MAX_END_POP; srv6db->config.max_h_encaps_msd = SRV6_MAX_H_ENCAPS; srv6db->config.max_end_d_msd = SRV6_MAX_END_D; + + /* Initialize SRv6 Locator chunks list */ + srv6db->srv6_locator_chunks = list_new(); } /** @@ -133,7 +137,16 @@ void isis_srv6_area_init(struct isis_area *area) */ void isis_srv6_area_term(struct isis_area *area) { + struct isis_srv6_db *srv6db = &area->srv6db; + struct listnode *node, *nnode; + struct srv6_locator_chunk *chunk; + sr_debug("ISIS-SRv6 (%s): Terminate SRv6", area->area_tag); + + /* Free SRv6 Locator chunks list */ + for (ALL_LIST_ELEMENTS(srv6db->srv6_locator_chunks, node, nnode, chunk)) + srv6_locator_chunk_free(&chunk); + list_delete(&srv6db->srv6_locator_chunks); } /** diff --git a/isisd/isis_srv6.h b/isisd/isis_srv6.h index d999f3b853..b0e92c8a5b 100644 --- a/isisd/isis_srv6.h +++ b/isisd/isis_srv6.h @@ -19,6 +19,9 @@ /* Per-area IS-IS SRv6 Data Base (SRv6 DB) */ struct isis_srv6_db { + /* List of SRv6 Locator chunks */ + struct list *srv6_locator_chunks; + /* Area SRv6 configuration. */ struct { /* Administrative status of SRv6 */