]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: Release SRv6 SIDs to SID Manager
authorCarmine Scarpitta <cscarpit@cisco.com>
Thu, 9 May 2024 11:03:45 +0000 (13:03 +0200)
committerCarmine Scarpitta <cscarpit@cisco.com>
Tue, 18 Jun 2024 16:33:29 +0000 (18:33 +0200)
Currently, IS-IS allocates SIDs without interacting with Zebra.

Recently, the SRv6 implementation has been improved. Now, the daemons
need to interact with Zebra through ZAPI to obtain and release SIDs.

This commit extends IS-IS to release SIDs to Zebra when they are no
longer needed.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
isisd/isis_srv6.c

index 0cd7f847f8ffbf1dafa1342bd91b06e88dea4fa0..c7bc7f06929021a2a09e4614e6e34cef033271f0 100644 (file)
@@ -102,6 +102,7 @@ bool isis_srv6_locator_unset(struct isis_area *area)
        struct srv6_locator_chunk *chunk;
        struct isis_srv6_sid *sid;
        struct srv6_adjacency *sra;
+       struct srv6_sid_ctx ctx = {};
 
        if (strncmp(area->srv6db.config.srv6_locator_name, "",
                    sizeof(area->srv6db.config.srv6_locator_name)) == 0) {
@@ -120,13 +121,31 @@ bool isis_srv6_locator_unset(struct isis_area *area)
                 * Zebra */
                isis_zebra_srv6_sid_uninstall(area, sid);
 
+               /*
+                * Inform the SID Manager that IS-IS will no longer use the SID, so
+                * that the SID Manager can remove the SID context ownership from IS-IS
+                * and release/free the SID context if it is not yes by other protocols.
+                */
+               ctx.behavior = ZEBRA_SEG6_LOCAL_ACTION_END;
+               isis_zebra_release_srv6_sid(&ctx);
+
                listnode_delete(area->srv6db.srv6_sids, sid);
                isis_srv6_sid_free(sid);
        }
 
        /* Uninstall all local Adjacency-SIDs. */
-       for (ALL_LIST_ELEMENTS(area->srv6db.srv6_endx_sids, node, nnode, sra))
+       for (ALL_LIST_ELEMENTS(area->srv6db.srv6_endx_sids, node, nnode, sra)) {
+               /*
+                * Inform the SID Manager that IS-IS will no longer use the SID, so
+                * that the SID Manager can remove the SID context ownership from IS-IS
+                * and release/free the SID context if it is not yes by other protocols.
+                */
+               ctx.behavior = ZEBRA_SEG6_LOCAL_ACTION_END_X;
+               ctx.nh6 = sra->nexthop;
+               isis_zebra_release_srv6_sid(&ctx);
+
                srv6_endx_sid_del(sra);
+       }
 
        /* Inform Zebra that we are releasing the SRv6 locator */
        ret = isis_zebra_srv6_manager_release_locator_chunk(