bgpd: Replace the actual local-as when using replace-as with the confederation - #21551
Conversation
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
β¦ederation If we have something like: router bgp 12345 no bgp ebgp-requires-policy bgp confederation identifier 64512 neighbor 192.168.1.1 remote-as 65004 neighbor 192.168.3.3 remote-as 64515 neighbor 192.168.3.3 remove-private-AS all replace-AS Then 192.168.3.3 receives a route with AS PATH: 64512 12345, but 12345 should be replaced to 64512 because the peering is done using 64512 <-> 64515. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
c85b2f8 to
1f9e686
Compare
Greptile SummaryThis PR fixes a bug where Confidence Score: 5/5Safe to merge β targeted, correct fix with proper test coverage and no regression risk for non-confederation deployments. The fix is minimal and surgically correct: peer->local_as is already set to bgp->confed_id for external confederation peers by the existing bgpd.c logic, so reusing it here is consistent with the rest of the codebase. Non-confederation behavior is unchanged (peer->local_as == bgp->as in that case). The unused bgp parameter is suppressed by FRR's -Wno-unused-parameter flag. All remaining findings are P2 or lower. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant r1 as r1 (AS 65004)
participant r2 as r2 (AS 12345 / confed-id 64512)
participant r3 as r3 (AS 64515)
r1->>r2: UPDATE 10.0.0.1/32, AS_PATH: 65004
note over r2: remove-private-AS all replace-AS toward r3
note over r2: peer->local_as = bgp->confed_id = 64512<br/>(for external peer r3)
note over r2: BEFORE fix: replaces 65004 with bgp->as=12345<br/>path: 64512 12345 (wrong)
note over r2: AFTER fix: replaces 65004 with peer->local_as=64512<br/>path: 64512 64512 (correct)
r2->>r3: UPDATE 10.0.0.1/32, AS_PATH: 64512 64512
Reviews (2): Last reviewed commit: "bgpd: Replace the actual local-as when u..." | Re-trigger Greptile |
|
@greptileai seems you mixed something regarding regression... Please, re-evaluate carefully. |
Closes #21537