diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 951dbd1efc..9e75261a5c 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -1116,12 +1116,14 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn, /* * Routes that are redistributed into BGP from zebra do not get - * nexthop tracking. However, if those routes are subsequently - * imported to other RIBs within BGP, the leaked routes do not - * carry the original BGP_ROUTE_REDISTRIBUTE sub_type. Therefore, - * in order to determine if the route we are currently leaking - * should have nexthop tracking, we must find the ultimate - * parent so we can check its sub_type. + * nexthop tracking, unless MPLS allocation per nexthop is + * performed. In the default case nexthop tracking does not apply, + * if those routes are subsequently imported to other RIBs within + * BGP, the leaked routes do not carry the original + * BGP_ROUTE_REDISTRIBUTE sub_type. Therefore, in order to determine + * if the route we are currently leaking should have nexthop + * tracking, we must find the ultimate parent so we can check its + * sub_type. * * As of now, source_bpi may at most be a second-generation route * (only one hop back to ultimate parent for vrf-vpn-vrf scheme). diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 39aff8d500..bda163d7a5 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -1137,10 +1137,21 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc) } LIST_FOREACH (path, &(bnc->paths), nh_thread) { - if (!(path->type == ZEBRA_ROUTE_BGP - && ((path->sub_type == BGP_ROUTE_NORMAL) - || (path->sub_type == BGP_ROUTE_STATIC) - || (path->sub_type == BGP_ROUTE_IMPORTED)))) + if (path->type == ZEBRA_ROUTE_BGP && + (path->sub_type == BGP_ROUTE_NORMAL || + path->sub_type == BGP_ROUTE_STATIC || + path->sub_type == BGP_ROUTE_IMPORTED)) + /* evaluate the path */ + ; + else if (path->sub_type == BGP_ROUTE_REDISTRIBUTE) { + /* evaluate the path for redistributed routes + * except those from VNC + */ + if ((path->type == ZEBRA_ROUTE_VNC) || + (path->type == ZEBRA_ROUTE_VNC_DIRECT)) + continue; + } else + /* don't evaluate the path */ continue; dest = path->net; @@ -1242,6 +1253,16 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc) */ vpn_leak_from_vrf_update(bgp_get_default(), bgp_path, path); + else if (path->sub_type == BGP_ROUTE_REDISTRIBUTE && + safi == SAFI_UNICAST && + (bgp_path->inst_type == BGP_INSTANCE_TYPE_VRF || + bgp_path->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) + /* redistribute routes are always valid + * if nht is called with redistribute routes, the vpn + * exportation needs to be triggered + */ + vpn_leak_from_vrf_update(bgp_get_default(), bgp_path, + path); else if (path_valid != bnc_is_valid_nexthop) { if (path_valid) { /* No longer valid, clear flag; also for EVPN