From: Carmine Scarpitta Date: Wed, 22 Feb 2023 10:20:50 +0000 (+0100) Subject: isisd: Install SRv6 End SID automatically X-Git-Tag: base_9.1~88^2~98 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=58d85ce9657e991c9372605268bc15c09d69fcc6;p=mirror%2Ffrr.git isisd: Install SRv6 End SID automatically 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 --- diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index aecf7f6e69..de31a2d19a 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -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;