Skip to content

bgpd: move auto config flag from bgp to srv6 unicast policy - #21735

Merged
ton31337 merged 1 commit into
FRRouting:masterfrom
lsang96:srv6_unicast
Apr 23, 2026
Merged

bgpd: move auto config flag from bgp to srv6 unicast policy#21735
ton31337 merged 1 commit into
FRRouting:masterfrom
lsang96:srv6_unicast

Conversation

@lsang96

@lsang96 lsang96 commented Apr 22, 2026

Copy link
Copy Markdown

No description provided.

@frrbot frrbot Bot added the bgp label Apr 22, 2026
@greptile-apps

greptile-apps Bot commented Apr 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR refactors the SRv6 unicast auto-mode flag from BGP_CONFIG_SRV6_UNICAST_SID_AUTO stored in bgp->af_flags[afi][SAFI_UNICAST] to a new SRV6_POLICY_FLAG_SID_AUTO bit in bgp->srv6_unicast[afi].flags, consolidating SRv6 unicast policy state into struct srv6_policy. All four changed files are updated consistently and no references to the old macro remain.

Confidence Score: 5/5

Safe to merge — clean, mechanical refactoring with no remaining references to the old flag and the previously flagged P0 issue fully resolved.

All occurrences of BGP_CONFIG_SRV6_UNICAST_SID_AUTO have been migrated consistently across every consumer. The previously raised P0 concern (is_srv6_unicast_enabled reading from the stale location) is fixed. No remaining P0/P1 findings.

No files require special attention.

Important Files Changed

Filename Overview
bgpd/bgpd.h Adds SRV6_POLICY_FLAG_SID_AUTO (1 << 1) to struct srv6_policy and removes the now-superseded BGP_CONFIG_SRV6_UNICAST_SID_AUTO (1 << 12) from the top-level bgp flags.
bgpd/bgp_srv6.h Fixes is_srv6_unicast_enabled() to read the auto-mode flag from bgp->srv6_unicast[afi].flags instead of the now-removed bgp->af_flags location — resolves the previously raised P0 issue.
bgpd/bgp_srv6.c Updates all SET/UNSET/CHECK_FLAG calls for the auto-mode flag to use the new srv6_unicast[afi].flags field; removes the now-unused local safi variable.
bgpd/bgp_vty.c Migrates all VTY command and config-write references from the old af_flags-based flag to SRV6_POLICY_FLAG_SID_AUTO; removes the now-unused local safi variable in sid_export.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["sid export auto (VTY command)"] --> B["SET_FLAG(bgp->srv6_unicast[afi].flags,\nSRV6_POLICY_FLAG_SID_AUTO)"]
    B --> C["is_srv6_unicast_enabled(bgp, afi)"]
    C -->|"CHECK_FLAG srv6_unicast[afi].flags\nSRV6_POLICY_FLAG_SID_AUTO"| D["Returns true"]
    D --> E["bgp_srv6_unicast_ensure_afi_sid()"]
    E --> F["bgp_config_write_family()\nemits 'sid export auto'"]
    G["no sid export / delete"] --> H["UNSET_FLAG(bgp->srv6_unicast[afi].flags,\nSRV6_POLICY_FLAG_SID_AUTO)"]
    H --> I["bgp_srv6_unicast_delete()"]
Loading

Reviews (2): Last reviewed commit: "bgpd: move auto config flag from bgp to ..." | Re-trigger Greptile

@lsang96
lsang96 force-pushed the srv6_unicast branch 2 times, most recently from 0ee6e9b to 650bb88 Compare April 22, 2026 14:52
@github-actions github-actions Bot added size/M and removed size/S labels Apr 22, 2026
Move SID allocation auto mode on bgp to srv6 unicast policy. This is a
better fit and rename to SRV6_POLICY_FLAG_SID_AUTO.

Signed-off-by: Loïc Sang <loic.sang@6wind.com>
@lsang96

lsang96 commented Apr 22, 2026

Copy link
Copy Markdown
Author

@greptile review

@ton31337
ton31337 merged commit 6578290 into FRRouting:master Apr 23, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants