Skip to content

Conversation

@GaladrielZhao
Copy link
Contributor

@GaladrielZhao GaladrielZhao commented Mar 27, 2025

The current implementation supports BGP using SIDs allocated in two modes, including index-mode and auto-mode.
This PR adds support for BGP to use SRv6 SIDs in an explicit way.

Add "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>".

By configuring sid vpn per-vrf export explicit X:X::X:X in the context of a Vrf (where X:X::X:X is the explicit SID value), BGP will request the explicit SID from Zebra and advertise it if the allocation in Zebra is successful.

@frrbot frrbot bot added bgp bugfix libfrr tests Topotests, make check, etc zebra labels Mar 27, 2025
@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch 2 times, most recently from 3b589de to 8e9ed78 Compare March 27, 2025 06:57
@mjstapp
Copy link
Contributor

mjstapp commented Mar 27, 2025

there are a lot of code format issues - please run checkpatch and 'git-clang-format --diff' and take a look at the results, and fix the important things: alignment, extra whitespace, etc. clang will try to extend lines to 100, and that's not required, but there appear to be lines >100, and those must be fixed. clang also does some terrible things to some manual alignments, as we often do for flag definitions and enums; it's not necessary to make clang's changes, but anything you change should fit what is already present.

zebra/zapi_msg.c Outdated
struct zserv *client;

frr_each (zserv_client_list, &zrouter.client_list, client) {
zsend_srv6_static_sid_update_internal(client);
Copy link
Contributor

Choose a reason for hiding this comment

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

no, we can't blindly send zapi messages to every daemon, when only one (?) is interested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The modifications here are implemented in line with the logic of sending notifications to various daemons after locator configuration:

void zebra_srv6_locator_add(struct srv6_locator *locator)
{
    struct zebra_srv6 *srv6 = zebra_srv6_get_default();
    struct srv6_locator *tmp;
    struct zserv *client;

    tmp = zebra_srv6_locator_lookup(locator->name);
    if (!tmp)
        listnode_add(srv6->locators, locator);

    /*
	 * Notify new locator info to zclients.
	 *
	 * The srv6 locators and their prefixes are managed by zserv(zebra).
	 * And an actual configuration the srv6 sid in the srv6 locator is done
	 * by zclient(bgpd, isisd, etc). The configuration of each locator
	 * allocation and specify it by zserv and zclient should be
	 * asynchronous. For that, zclient should be received the event via
	 * ZAPI when a srv6 locator is added on zebra.
	 * Basically, in SRv6, adding/removing SRv6 locators is performed less
	 * frequently than adding rib entries, so a broad to all zclients will
	 * not degrade the overall performance of FRRouting.
	 */
    frr_each (zserv_client_list, &zrouter.client_list, client) {
        zsend_zebra_srv6_locator_add(client, locator);
    }
}

Currently, there is no subscription-like record variable or operation in the srv6_locator and srv6_sid data structures for the daemons which use the msg, and the configuration frequency of srv6 static sids is similarly low as that of srv6 locators. From my current perspective, it might be considered a better choice to send the msg to daemons in a loop, rather than hard-coding it to send to the BGP.

Hi @cscarpitta, I'm not sure if my understanding is correct. If it's not, could you please help explain a bit?

@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch 7 times, most recently from 8ede9e4 to 7abcdd8 Compare March 31, 2025 09:46
@GaladrielZhao
Copy link
Contributor Author

there are a lot of code format issues - please run checkpatch and 'git-clang-format --diff' and take a look at the results, and fix the important things: alignment, extra whitespace, etc. clang will try to extend lines to 100, and that's not required, but there appear to be lines >100, and those must be fixed. clang also does some terrible things to some manual alignments, as we often do for flag definitions and enums; it's not necessary to make clang's changes, but anything you change should fit what is already present.

@mjstapp Thanks. I have fixed all format errors in my modifications that can be changed. I did not apply the fixing patch to the codes that were already merged previously. Additionally, some of the format suggestions are viewed as errors by "checkout code" part in CI, so I did not change those either. If there are further code updates, I will promptly make adjustments based on the results from frrbot and checkout code.

@riw777 riw777 self-requested a review April 1, 2025 15:36
@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch 2 times, most recently from 1a915ef to 5362b3a Compare April 2, 2025 14:01
@github-actions
Copy link

github-actions bot commented Apr 9, 2025

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

@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch from 5362b3a to 18a05ba Compare April 23, 2025 06:18
@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch 4 times, most recently from 68df460 to 8701761 Compare May 13, 2025 04:32
@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch from 8701761 to 123a83d Compare May 13, 2025 05:46
@frrbot frrbot bot added the documentation label May 13, 2025
Add support for bgp to use explicit SRv6 SID.
Use configuration "sid vpn per-vrf export explicit X:X::X:X"
in vrf context to request the explicit SID from Zebra.
If SRv6 SID manager allocates the explicit SID successfully,
then BGP will advertise it.

Signed-off-by: Yuqing Zhao <[email protected]>
@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch from 937b6e9 to bd013ed Compare May 13, 2025 06:57
@GaladrielZhao GaladrielZhao changed the title bgpd: Add support for bgp to use SRv6 SID in an explicit way bgpd: Add support for BGP to use SRv6 SID in an explicit way May 13, 2025
Copy link

@ahsalam ahsalam left a comment

Choose a reason for hiding this comment

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

LGTM. Many thanks for updating the design. The new design is good and solve the issue of the notification from Zebra to the daemons.

Copy link
Contributor

@zice312963205 zice312963205 left a comment

Choose a reason for hiding this comment

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

LGTM

Add BGP explicit SID configuration in bgp.rst.

Signed-off-by: Yuqing Zhao <[email protected]>
@GaladrielZhao GaladrielZhao force-pushed the bgp_srv6_sid_explicit branch from bd013ed to a9c8e72 Compare May 13, 2025 08:07
@GaladrielZhao
Copy link
Contributor Author

ci:rerun

Copy link
Contributor

@cscarpitta cscarpitta left a comment

Choose a reason for hiding this comment

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

LGTM

@cscarpitta cscarpitta merged commit 7774f47 into FRRouting:master May 13, 2025
13 checks passed
wangxin pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jul 1, 2025
…n tests (#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
cscarpitta added a commit to cscarpitta/sonic-buildimage that referenced this pull request Oct 21, 2025
Port the following fixes from FRR mainline:
- zebra: Add CLI to display SRv6 SIDs allocated (FRRouting/frr#16836)
- bgpd: add usid behavior for bgp srv6 instructions (FRRouting/frr#18611)
- bgpd: Implement Link-Local Next Hop capability (FRRouting/frr#17871)
- Add BGP redistribution in SRv6 BGP (FRRouting/frr#18396)
- bgpd: Add support for BGP to use SRv6 SID in an explicit way (FRRouting/frr#18519)
- lib, staticd, isisd: add B6.ENCAPS codepoint extensions (FRRouting/frr#18597)
- zebra: Provide SID value when sending SRv6 SID release notify message (FRRouting/frr#18971)
- zebra: Cleanup SRv6 output of show running-config (FRRouting/frr#18970)
- zebra: Free up tt when failure mode happens (FRRouting/frr@0521673)
- SRv6: Add support for multiple SRv6 locators (FRRouting/frr#18806)

Signed-off-by: Carmine Scarpitta <[email protected]>
cscarpitta added a commit to cscarpitta/sonic-buildimage that referenced this pull request Oct 21, 2025
Port the following fixes from FRR mainline:
- zebra: Add CLI to display SRv6 SIDs allocated (FRRouting/frr#16836)
- bgpd: add usid behavior for bgp srv6 instructions (FRRouting/frr#18611)
- bgpd: Implement Link-Local Next Hop capability (FRRouting/frr#17871)
- Add BGP redistribution in SRv6 BGP (FRRouting/frr#18396)
- bgpd: Add support for BGP to use SRv6 SID in an explicit way (FRRouting/frr#18519)
- lib, staticd, isisd: add B6.ENCAPS codepoint extensions (FRRouting/frr#18597)
- zebra: Provide SID value when sending SRv6 SID release notify message (FRRouting/frr#18971)
- zebra: Cleanup SRv6 output of show running-config (FRRouting/frr#18970)
- zebra: Free up tt when failure mode happens (FRRouting/frr@0521673)
- SRv6: Add support for multiple SRv6 locators (FRRouting/frr#18806)

Signed-off-by: Carmine Scarpitta <[email protected]>
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
cscarpitta added a commit to cscarpitta/sonic-buildimage that referenced this pull request Oct 27, 2025
Port the following fixes from FRR mainline:
- zebra: Add CLI to display SRv6 SIDs allocated (FRRouting/frr#16836)
- bgpd: add usid behavior for bgp srv6 instructions (FRRouting/frr#18611)
- bgpd: Implement Link-Local Next Hop capability (FRRouting/frr#17871)
- Add BGP redistribution in SRv6 BGP (FRRouting/frr#18396)
- bgpd: Add support for BGP to use SRv6 SID in an explicit way (FRRouting/frr#18519)
- lib, staticd, isisd: add B6.ENCAPS codepoint extensions (FRRouting/frr#18597)
- zebra: Provide SID value when sending SRv6 SID release notify message (FRRouting/frr#18971)
- zebra: Cleanup SRv6 output of show running-config (FRRouting/frr#18970)
- zebra: Free up tt when failure mode happens (FRRouting/frr@0521673)
- SRv6: Add support for multiple SRv6 locators (FRRouting/frr#18806)
- zebra: Fix SRv6 explicit SID allocation to use the provided locator (FRRouting/frr@a9044d2)
Signed-off-by: Carmine Scarpitta <[email protected]>
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
Signed-off-by: Guy Shemesh <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
Signed-off-by: Guy Shemesh <[email protected]>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
…n tests (sonic-net#19206)

Summary:
Update sid_vpn_per_vrf_export_explicit config for srv6 tests according to the latest modification in FRR.
FRR adds "explicit" option for configuration "sid vpn per-vrf export <(1..1048575)|auto|explicit X:X::X:X>" to use SRv6 SIDs in an explicit way.
Frrcfgd has been updated to support new config way.
FRR PR: FRRouting/frr#18519
frrcfgd PR: sonic-net/sonic-buildimage#23107

Signed-off-by: 红蔻 <[email protected]>
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