bgpd: Fix SRv6 SID export route-map update not taking effect#21283
Merged
donaldsharp merged 2 commits intoFRRouting:masterfrom Mar 22, 2026
Merged
bgpd: Fix SRv6 SID export route-map update not taking effect#21283donaldsharp merged 2 commits intoFRRouting:masterfrom
donaldsharp merged 2 commits intoFRRouting:masterfrom
Conversation
When `sid export ... route-map <name>` is reconfigured with a different route-map on an already-configured SID export, the new route-map is silently ignored. The code skips the early-return (rmap_str != rmap_name), but then calls bgp_srv6_unicast_announce() without updating rmap_name, so the old route-map remains in effect. Fix this by replacing rmap_name before triggering the re-announce: decrement the reference count on the old route-map, free its name string, assign the new name, and increment the reference count on the new route-map. Signed-off-by: Carmine Scarpitta <[email protected]>
Greptile SummaryThis PR fixes a bug where reconfiguring Changes:
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[sid export route-map VTY command] --> B{SID already configured?}
B -- No --> C[Initial setup: XSTRDUP rmap_name, increment ref, ensure SID]
B -- Yes --> D{rmap_str same as current rmap_name?}
D -- Same or NULL --> E[Return CMD_SUCCESS no-op]
D -- Different --> F[Decrement old rmap ref count]
F --> G[XFREE old rmap_name]
G --> H[XSTRDUP new rmap_name]
H --> I[Increment new rmap ref count]
I --> J[bgp_srv6_unicast_announce with new route-map]
J --> K[Return CMD_SUCCESS - new route-map in effect]
Reviews (1): Last reviewed commit: "tests: Add test for sid export route-map..." | Re-trigger Greptile |
Add test_bgp_srv6_sid_rmap_update() to verify that replacing an already-configured sid export route-map with a different one correctly applies the new policy. The test reconfigures R1 with a new route-map (filter2) that excludes 10.0.0.1/32 from SID assignment, confirms the prefix loses its SRv6 encapsulation on R2 and becomes uninstalled on R3, then restores the original route-map (filter) and verifies that SRv6 encapsulation is re-established on both peers. Signed-off-by: Carmine Scarpitta <[email protected]>
78b5149 to
141ca52
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
sid export ... route-map <name>is reconfigured with a different route-map on an already-configured SID export, the new route-map is silently ignored. The code skips the early-return (rmap_str != rmap_name), but then callsbgp_srv6_unicast_announce()without updatingrmap_name, so the old route-map remains in effect.Fix this by replacing
rmap_namebefore triggering the re-announce: decrement the reference count on the old route-map, free its name string, assign the new name, and increment the reference count on the new route-map.