]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: Remove SRv6 End SIDs after locator unset
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Tue, 13 Jun 2023 11:09:57 +0000 (13:09 +0200)
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Mon, 11 Sep 2023 15:35:07 +0000 (17:35 +0200)
When an SRv6 locator is unset, remove all the SRv6 End SIDs allocated
from that locator.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
isisd/isis_srv6.c

index 294056416dfee6d3a2de49db04fce543c380ef1a..588a8fdd402c1bddfe53dee99149fde1fb84cf1f 100644 (file)
@@ -32,6 +32,7 @@ bool isis_srv6_locator_unset(struct isis_area *area)
        int ret;
        struct listnode *node, *nnode;
        struct srv6_locator_chunk *chunk;
+       struct isis_srv6_sid *sid;
 
        if (strncmp(area->srv6db.config.srv6_locator_name, "",
                    sizeof(area->srv6db.config.srv6_locator_name)) == 0) {
@@ -39,6 +40,21 @@ bool isis_srv6_locator_unset(struct isis_area *area)
                return true;
        }
 
+       /* Delete SRv6 SIDs */
+       for (ALL_LIST_ELEMENTS(area->srv6db.srv6_sids, node, nnode, sid)) {
+               sr_debug(
+                       "Deleting SRv6 SID (locator %s, sid %pI6) from IS-IS area %s",
+                       area->srv6db.config.srv6_locator_name, &sid->sid,
+                       area->area_tag);
+
+               /* Uninstall the SRv6 SID from the forwarding plane through
+                * Zebra */
+               isis_zebra_srv6_sid_uninstall(area, sid);
+
+               listnode_delete(area->srv6db.srv6_sids, sid);
+               isis_srv6_sid_free(sid);
+       }
+
        /* Inform Zebra that we are releasing the SRv6 locator */
        ret = isis_zebra_srv6_manager_release_locator_chunk(
                area->srv6db.config.srv6_locator_name);