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 <carmine.scarpitta@uniroma2.it>
This commit is contained in:
Carmine Scarpitta 2023-02-22 11:20:50 +01:00
parent ea7f533352
commit 58d85ce965

View File

@ -1024,6 +1024,8 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS)
struct isis_area *area; struct isis_area *area;
struct srv6_locator_chunk *c; struct srv6_locator_chunk *c;
struct srv6_locator_chunk *chunk = srv6_locator_chunk_alloc(); struct srv6_locator_chunk *chunk = srv6_locator_chunk_alloc();
struct isis_srv6_sid *sid;
enum srv6_endpoint_behavior_codepoint behavior;
bool allocated = false; bool allocated = false;
/* Decode the received zebra message */ /* 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 */ /* Add the SRv6 Locator chunk to the per-area chunks list */
listnode_add(area->srv6db.srv6_locator_chunks, chunk); 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); lsp_regenerate_schedule(area, area->is_type, 0);
allocated = true; allocated = true;