Skip to content

Conversation

@cscarpitta
Copy link
Contributor

@cscarpitta cscarpitta commented Apr 26, 2025

Currently the SRv6 SID Manager supports two allocation modes:

  • DYNAMIC, which means "give me any SID"
  • EXPLICIT, which means "give me a specific SID"

STATIC allocates EXPLICIT SIDs
BGP and ISIS allocate DYNAMIC SIDs

Each daemon allocate and use their own SIDs. Sharing a SID between multiple daemons is not supported.

This PR extends the SRv6 SID Manager to support the sharing of a SID between multiple daemons.

When daemons make a `GET_SRV6_SID` request, they should be able to
specify if they want an explicit SID or a dynamic SID.

Currently this is not possible, because the enum srv6_sid_alloc_mode,
which defines the "explicit" and "dynamic" allocation modes, is defined
in the `zebra/zebra_srv6.h` header file. This means that only zebra has
visibility of it.

This patch moves the enum `srv6_sid_alloc_mode` from `zebra/zebra_srv6.h`
to `lib/srv6.h` to allow other daemons to use it.

Signed-off-by: Carmine Scarpitta <[email protected]>
This commit extends the SRv6 SID Manager to support the sharing of an
explicit SID between multiple daemons.

Right now, daemons can request SID Manager to allocate a SID for a
given context.

This commit extends the context by adding a new field "alloc_mode".
This field allows daemons to request a SID in two ways:
- DYNAMIC means "give me any available SID"
- EXPLICIT means "give me a specific SID"

When a daemon request to allocate an EXPLICIT SID for a context, we
check if we already have an EXPLICIT SID for that context.
- If we already have a SID (e.g., a SID that has been previously
  allocated by STATIC) we share and return the existing SID.
- If we don't have a SID yet, we allocate a new SID for that context.

Signed-off-by: Carmine Scarpitta <[email protected]>
Previous commit added a new field "alloc_mode" to the SID context. This
commit extends STATIC to fill this field when making a `GET_SRV6_SID` or
`RELEASE_SRV6_SID` request. Since STATIC can only allocate EXPLICIT SIDs,
this field will be always set to EXPLICIT.

Signed-off-by: Carmine Scarpitta <[email protected]>
Previous commit added a new field "alloc_mode" to the SID context. This
commit extends BGP to fill this field when making a `GET_SRV6_SID` or
`RELEASE_SRV6_SID` request. This field will be set to EXPLICIT or DYNAMIC
depending on whether BGP is asking for a specific SID or any SID.

Signed-off-by: Carmine Scarpitta <[email protected]>
@frrbot frrbot bot added the zebra label Apr 28, 2025
Fix the following warning reported by checkpatch:

Report for zapi_msg.c | 2 issues
===============================================
< WARNING: braces {} are not necessary for single statement blocks
< FRRouting#3068: FILE: /tmp/f1-2075761/zapi_msg.c:3068:

Signed-off-by: Carmine Scarpitta <[email protected]>
ifindex_t ifindex;

enum srv6_sid_alloc_mode alloc_mode;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the interest of passing alloc_mode ?
passing a non zero sid value to the zapi message is not enough to say it is an explicit or an automatic value ?

are you trying to handle an other use case ? (allocating index 0), or are you trying to fix something else ?

Copy link

@dmytroshytyi dmytroshytyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi thank you for this submission. After rapid parsing I have a comment.

srv6_sid_ctx2str(buf, sizeof(buf), ctx));
*sid = s->sid;
return 0;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the scope of get_srv6_sid_explicit() why this case1 ("Condition: A daemon requested SID Manager to allocate any SID for the ctx") is applicable ? It looks like condition describes "any" sid while function scope is "specific" sid.

@github-actions
Copy link

github-actions bot commented May 1, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@pguibert6WIND
Copy link
Member

Please confirm the use case: BGP will want to reuse same SID as the one that STATIC allocated. This permits to redistribute srv6 SIDs into BGP. Right ?

As alternate method, did you think of improving the 'redistribute static' command in BGP to distribute srv6 updates?

@ton31337
Copy link
Member

ton31337 commented Sep 4, 2025

How can we verify SID sharing between daemons?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants