diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2023-06-01 07:20:06 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2023-06-16 10:55:17 +0200 |
commit | b9c7e7a1a9ab22e83571652ff092bb519a7386f7 (patch) | |
tree | eea95d39e79bd87a6fce58770e16ef2107f0d3ce /bgpd/bgp_nht.c | |
parent | doc: add 'mpls bgp l3vpn-multi-domain-switching' (diff) | |
download | frr-b9c7e7a1a9ab22e83571652ff092bb519a7386f7.tar.xz frr-b9c7e7a1a9ab22e83571652ff092bb519a7386f7.zip |
bgpd: fix use nexthop tracking for exported vpn paths
When exporting redistributed prefixes from a given VRF
to an MPLS VPN network, the paths are always considered
as valid whereas it should not always be the case.
At exportation, a new MPLS VPN path is built in. Then
nexthop tracking is applied to the new path, and the
SAFI_MPLS_VPN parameter is used to tell the NHT code
to just check for the next-hop reachability. The previous
commit was wrongly considering that nexthop tracking was
never applied to mpls vpn networks. Ensure that nexthop
tracking for exported paths behaves as usual.
Fix this by not returning always 1 in the 'bgp_find_or_add_nexthop()'
function if the passed 'pi' parameter is a 'BGP_IMPORTED_ROUTE'
sub-type entry.
Fixes: 74be3f3ea9ec ("bgpd: track mpls vpn nexthops")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to '')
-rw-r--r-- | bgpd/bgp_nht.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 4770434b6..ba5b0c7a7 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -468,10 +468,12 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, pi->sub_type == BGP_ROUTE_IMPORTED && pi->extra && pi->extra->num_labels && !bnc->is_evpn_gwip_nexthop) return bgp_isvalid_nexthop_for_mpls(bnc, pi); - else if (safi == SAFI_MPLS_VPN) + else if (safi == SAFI_MPLS_VPN && pi && + pi->sub_type != BGP_ROUTE_IMPORTED) /* avoid not redistributing mpls vpn routes */ return 1; else + /* mpls-vpn routes with BGP_ROUTE_IMPORTED subtype */ return (bgp_isvalid_nexthop(bnc)); } @@ -1194,10 +1196,12 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc) bnc_is_valid_nexthop = bgp_isvalid_nexthop_for_mpls(bnc, path) ? true : false; - } else if (safi == SAFI_MPLS_VPN) { + } else if (safi == SAFI_MPLS_VPN && + path->sub_type != BGP_ROUTE_IMPORTED) { /* avoid not redistributing mpls vpn routes */ bnc_is_valid_nexthop = true; } else { + /* mpls-vpn routes with BGP_ROUTE_IMPORTED subtype */ if (bgp_update_martian_nexthop( bnc->bgp, afi, safi, path->type, path->sub_type, path->attr, dest)) { |