frr
frr copied to clipboard
Not correct reason description in bgp bestpath
example topo:
|---------------------- R3 -------- 192.168.199.0/24
| 192.16.3.0/24 RID 1.1.1.3
| AS 65003
| MED 150
|
|
| 192.16.2.0/24
R1 -------------------- R2 -------- 192.168.199.0/24
AS 65001 RID 1.1.1.2
| AS 65024
| MED 200
|
|
|---------------------- R4 -------- 192.168.199.0/24
192.16.4.0/24 RID 1.1.1.4
AS 65024
MED 100
R1:
debug bgp bestpath 192.168.199.0/24
router bgp 65001
no bgp ebgp-requires-policy
neighbor 192.168.2.2 remote-as 65024
neighbor 192.168.3.3 remote-as 65003
neighbor 192.168.4.4 remote-as 65024
exit
R2:
ip prefix-list ned_pref_out seq 10 permit 192.168.199.0/24
router bgp 65024
bgp router-id 1.1.1.2
no bgp ebgp-requires-policy
neighbor 192.168.2.1 remote-as 65001
!
address-family ipv4 unicast
network 192.168.199.0/24
neighbor 192.168.2.1 route-map med_rp_out out
exit-address-family
exit
!
route-map med_rp_out permit 10
match ip address prefix-list ned_pref_out
set metric 200
exit
R3:
ip prefix-list med_pref_out seq 10 permit 192.168.199.0/24
!
router bgp 65003
bgp router-id 1.1.1.3
no bgp ebgp-requires-policy
neighbor 192.168.3.1 remote-as 65001
!
address-family ipv4 unicast
network 192.168.199.0/24
neighbor 192.168.3.1 route-map med_rp_out out
exit-address-family
exit
!
route-map med_rp_out permit 10
match ip address prefix-list med_pref_out
set metric 150
exit
R4:
ip prefix-list med_pref_out seq 10 permit 192.168.199.0/24
!
router bgp 65024
bgp router-id 1.1.1.4
no bgp ebgp-requires-policy
neighbor 192.168.4.1 remote-as 65001
!
address-family ipv4 unicast
network 192.168.199.0/24
neighbor 192.168.4.1 route-map med_rp_out out
exit-address-family
exit
!
route-map med_rp_out permit 10
match ip address prefix-list med_pref_out
set metric 100
exit
Run R2, then R3, then R4
- Run R2 R1 info:
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast start
192.168.199.0/24(VRF default): After path selection, newbest is path 192.168.2.2 oldbest was NONE
192.168.199.0/24(VRF default): path 192.168.2.2 is the bestpath, add to the multipath list
192.168.199.0/24(VRF default): starting mpath update, newbest 192.168.2.2 num candidates 1 old-mpath-count 0 old-cum-bw 0
192.168.199.0/24(VRF default): comparing candidate 192.168.2.2 with existing mpath NONE
192.168.199.0/24(VRF default): New mpath count (incl newbest) 1 mpath-change NO all_paths_lb 0 cum_bw 0
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast, old_select=0x0, new_select=0x1721190
bgp_process_main_one: 192.168.199.0/24 setting SELECTED flag
# do show bgp ipv4 192.168.199.0/24
BGP routing table entry for 192.168.199.0/24, version 6
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.2.2
65024
192.168.2.2 from 192.168.2.2 (1.1.1.2)
Origin IGP, metric 200, valid, external, best (First path received)
Last update: Wed Sep 25 13:12:45 2024
- Run R3 R1 info:
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast start
192.168.199.0/24(VRF default): Comparing path 192.168.3.3 flags Valid Counted Unsorted with path 192.168.2.2 flags Selected Valid Counted
192.168.199.0/24: path 192.168.3.3 loses to path 192.168.2.2 due to oldest external
192.168.199.0/24(VRF default): After path selection, newbest is path 192.168.2.2 oldbest was 192.168.2.2
192.168.199.0/24(VRF default): path 192.168.2.2 is the bestpath, add to the multipath list
192.168.199.0/24(VRF default): Comparing path 192.168.3.3 flags Valid Counted with path 192.168.2.2 flags Selected Valid Counted
192.168.199.0/24: path 192.168.3.3 loses to path 192.168.2.2 due to oldest external <---------- OK
192.168.199.0/24(VRF default): starting mpath update, newbest 192.168.2.2 num candidates 1 old-mpath-count 0 old-cum-bw 0
192.168.199.0/24(VRF default): comparing candidate 192.168.2.2 with existing mpath NONE
192.168.199.0/24(VRF default): New mpath count (incl newbest) 1 mpath-change NO all_paths_lb 0 cum_bw 0
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast, old_select=0x1721190, new_select=0x1721190
# do show bgp ipv4 192.168.199.0/24
BGP routing table entry for 192.168.199.0/24, version 6
Paths: (1 available, best #1, table default)
Advertised to non peer-group peers:
192.168.2.2 192.168.3.3
65024
192.168.2.2 from 192.168.2.2 (1.1.1.2)
Origin IGP, metric 200, valid, external, best (Older Path) <---------- OK
Last update: Wed Sep 25 13:12:45 2024
65003
192.168.3.3 from 192.168.3.3 (1.1.1.3)
Origin IGP, metric 150, valid, external
Last update: Wed Sep 25 13:15:32 2024
- Run R4 R1 info:
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast start
192.168.199.0/24(VRF default): Comparing path 192.168.4.4 flags Valid Counted Unsorted with path 192.168.2.2 flags Selected Valid Counted
192.168.199.0/24: path 192.168.4.4 wins over path 192.168.2.2 due to MED 100 < 200
192.168.199.0/24(VRF default): After path selection, newbest is path 192.168.4.4 oldbest was 192.168.2.2
192.168.199.0/24(VRF default): path 192.168.4.4 is the bestpath, add to the multipath list
192.168.199.0/24(VRF default): Comparing path 192.168.2.2 flags Selected Valid Counted with path 192.168.4.4 flags Valid Counted
192.168.199.0/24: path 192.168.2.2 loses to path 192.168.4.4 due to MED 200 > 100 <------- OK: 192.168.4.4 is best
192.168.199.0/24(VRF default): Comparing path 192.168.3.3 flags Valid Counted with path 192.168.4.4 flags Valid Counted
192.168.199.0/24: path 192.168.3.3 wins over path 192.168.4.4 due to Router-ID comparison <-------- rewrite dest->reason
192.168.199.0/24(VRF default): starting mpath update, newbest 192.168.4.4 num candidates 1 old-mpath-count 0 old-cum-bw 0
192.168.199.0/24(VRF default): comparing candidate 192.168.4.4 with existing mpath NONE
192.168.199.0/24(VRF default): New mpath count (incl newbest) 1 mpath-change NO all_paths_lb 0 cum_bw 0
bgp_process_main_one: p=192.168.199.0/24(VRF default) afi=IPv4, safi=unicast, old_select=0x1721190, new_select=0x17360a0
bgp_process_main_one: 192.168.199.0/24 setting SELECTED flag
# do show bgp ipv4 192.168.199.0/24
BGP routing table entry for 192.168.199.0/24, version 7
Paths: (3 available, best #1, table default)
Advertised to non peer-group peers:
192.168.2.2 192.168.3.3 192.168.4.4
65024
192.168.4.4 from 192.168.4.4 (1.1.1.4)
Origin IGP, metric 100, valid, external, best (Router ID) <-- 192.168.4.4 is best via MED, but have dest->reason=router-id
Last update: Wed Sep 25 13:17:51 2024
65024
192.168.2.2 from 192.168.2.2 (1.1.1.2)
Origin IGP, metric 200, valid, external
Last update: Wed Sep 25 13:12:45 2024
65003
192.168.3.3 from 192.168.3.3 (1.1.1.3)
Origin IGP, metric 150, valid, external
Last update: Wed Sep 25 13:15:32 2024
192.168.4.4 is best via MED, but have dest->reason=router-id
here bgp_path_info_cmp use for find paths_eq, but also update reason ? https://github.com/FRRouting/frr/blob/2203dc4777a3b72c0be428de224e398e523809f2/bgpd/bgp_route.c#L3245-L3257
@SergeKrier said he will start working on this issue.
Seems like this is a really great excuse for some new topotests.
reason is OK. Select route wrong. it seems necessary:
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 666adc4..ac22581 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3251,9 +3251,10 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
continue;
}
- bgp_path_info_cmp(bgp, pi, new_select, &paths_eq,
+ if (bgp_path_info_cmp(bgp, pi, new_select, &paths_eq,
mpath_cfg, debug, pfx_buf, afi, safi,
- &dest->reason);
+ &dest->reason))
+ new_select = pi;
if (paths_eq) {
if (debug)
This issue is stale because it has been open 180 days with no activity. Comment or remove the autoclose label in order to avoid having this issue closed.
This issue will be automatically closed in the specified period unless there is further activity.