diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-02-12 20:42:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 20:42:03 +0100 |
commit | 26faf341ef55e3f6a23c53b9513eace79af44275 (patch) | |
tree | c3a5269a8694198f326f8032b6438aa61c6a96a4 | |
parent | Merge pull request #15358 from LabNConsulting/chopps/doc-update (diff) | |
parent | bgpd: fix route recursion on leaked routes (diff) | |
download | frr-26faf341ef55e3f6a23c53b9513eace79af44275.tar.xz frr-26faf341ef55e3f6a23c53b9513eace79af44275.zip |
Merge pull request #15352 from louis-6wind/fix-leak-recursive
bgpd: fix route recursion on leaked routes
-rw-r--r-- | bgpd/bgp_zebra.c | 13 | ||||
-rw-r--r-- | tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py | 7 |
2 files changed, 11 insertions, 9 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index dcbb87e96..1172514e5 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1511,6 +1511,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, struct bgp_path_info *info, struct bgp *bgp, afi_t afi, safi_t safi) { + struct bgp_path_info *bpi_ultimate; struct zapi_route api = { 0 }; unsigned int valid_nh_count = 0; bool allow_recursion = false; @@ -1554,15 +1555,9 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p, peer = info->peer; - if (info->type == ZEBRA_ROUTE_BGP - && info->sub_type == BGP_ROUTE_IMPORTED) { - - /* Obtain peer from parent */ - if (info->extra && info->extra->vrfleak && - info->extra->vrfleak->parent) - peer = ((struct bgp_path_info *)(info->extra->vrfleak - ->parent)) - ->peer; + if (info->type == ZEBRA_ROUTE_BGP) { + bpi_ultimate = bgp_get_imported_bpi_ultimate(info); + peer = bpi_ultimate->peer; } tag = info->attr->tag; diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py index 28047f7b2..217657d35 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py @@ -891,4 +891,11 @@ luCommand( "pass", "Redundant route 2 details", ) +luCommand( + "r1", + 'vtysh -c "show ip route vrf r1-cust5 5.1.0.0/24"', + "Known via .bgp., distance 200, .* vrf r1-cust5, best", + "pass", + "Recursive route leak details", +) # done |