]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: Install SRv6 End SID automatically
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Wed, 22 Feb 2023 10:20:50 +0000 (11:20 +0100)
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Mon, 11 Sep 2023 15:35:06 +0000 (17:35 +0200)
When zebra assigns a chunk to IS-IS, zebra sends a
ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK notification to IS-IS.
IS-IS invokes the `isis_zebra_process_srv6_locator_chunk()` callback to
process the received notification.

Actually, `isis_zebra_process_srv6_locator_chunk()` iterates over all
areas of the current IS-IS instance and looks for an area for which the
received chunk was requested.
If a match is found, the new chunk is added to the area's chunk list and
`lsp_regenerate_schedule()` is called to regenerate the LSPs to
advertise the new SRv6 locator.

This commit extends the `isis_zebra_process_srv6_locator_chunk()`
function to automatically allocate an SRv6 End SID from the received
chunk and install it in the data plane.

The SRv6 End SID is the instantiation of a Prefix-SID (RFC 8986 section

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

index aecf7f6e691eeefaf74388ee2bed88d40c7b6c78..de31a2d19a0c9105019b658704ee3ec44b60e17e 100644 (file)
@@ -1024,6 +1024,8 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
        struct isis_area *area;
        struct srv6_locator_chunk *c;
        struct srv6_locator_chunk *chunk = srv6_locator_chunk_alloc();
+       struct isis_srv6_sid *sid;
+       enum srv6_endpoint_behavior_codepoint behavior;
        bool allocated = false;
 
        /* Decode the received zebra message */
@@ -1060,7 +1062,25 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
                /* Add the SRv6 Locator chunk to the per-area chunks list */
                listnode_add(area->srv6db.srv6_locator_chunks, chunk);
 
-               /* Regenerate LSPs to advertise the new locator */
+               /* Decide which behavior to use,depending on the locator type
+                * (i.e. uSID vs classic locator) */
+               behavior = (CHECK_FLAG(chunk->flags, SRV6_LOCATOR_USID))
+                                  ? SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID
+                                  : SRV6_ENDPOINT_BEHAVIOR_END;
+
+               /* Allocate new SRv6 End SID */
+               sid = isis_srv6_sid_alloc(area, chunk, behavior, 0);
+               if (!sid)
+                       return -1;
+
+               /* Install the new SRv6 End SID in the forwarding plane through
+                * Zebra */
+               isis_zebra_srv6_sid_install(area, sid);
+
+               /* Store the SID */
+               listnode_add(area->srv6db.srv6_sids, sid);
+
+               /* Regenerate LSPs to advertise the new locator and the SID */
                lsp_regenerate_schedule(area, area->is_type, 0);
 
                allocated = true;