bgpd: Print neighbor link type correctly according to local-as#21486
Conversation
Greptile SummaryThis PR fixes Confidence Score: 5/5Safe to merge — targeted display-logic fix with a new topotest covering the reported scenario. All changes are narrowly scoped to the neighbor link-type classification in No files require special attention.
|
| Filename | Overview |
|---|---|
| bgpd/bgp_vty.c | Adds change_local_as equality check to correctly classify iBGP peers when local-as masking is active; also fixes as_type == AS_EXTERNAL to CHECK_FLAG for consistency with the AS_INTERNAL path. |
| tests/topotests/bgp_remote_as_auto/test_bgp_remote_as_auto.py | Adds _bgp_neighbors test verifying correct nbrExternalLink/nbrInternalLink classification, and extends _bgp_converge to include r5 in the established-peers check. |
| tests/topotests/bgp_remote_as_auto/r1/frr.conf | Adds neighbor 192.168.1.5 with local-as 65005 no-prepend replace-as to simulate the iBGP masking scenario under test. |
| tests/topotests/bgp_remote_as_auto/r5/frr.conf | New router configuration for r5 (AS 65005) with remote-as auto, forming the iBGP-masking peer for r1 in the new test case. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[bgp_show_peer: determine link type] --> B{p->as == p->local_as?}
B -- Yes --> E[Internal / Confed-Internal Link]
B -- No --> C{p->change_local_as != 0\nAND p->as == p->change_local_as?}
C -- Yes --> E
C -- No --> D{CHECK_FLAG as_type AS_INTERNAL?}
D -- Yes --> E
D -- No --> F{p->as != 0\nOR CHECK_FLAG as_type AS_EXTERNAL?}
F -- Yes --> G[External / Confed-External Link]
F -- No --> H[Unspecified Link]
Reviews (1): Last reviewed commit: "tests: Check if the correct link type is..." | Re-trigger Greptile
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
… auto Fixes: 0dfe256 ("bgpd: Implement `neighbor X remote-as auto`") Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Before this patch we compared remote-as vs. local-as (which is taken from BGP instance). But if we use `local-as X`, we should compare it too. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
ec52dc7 to
c4fe52d
Compare
Let's say we have something like: router bgp 65001 neighbor 192.168.1.5 remote-as internal neighbor 192.168.1.5 local-as 65005 no-prepend replace-as This way when the BGP OPEN is received it's treating 192.168.1.5 as external, because local-as is not evaluated, and 65001 is taken instead. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
c4fe52d to
4561cb2
Compare
Closes #21474