bgpd: Correctly identify VPN-imported routes in a VRF

Refine check that looks for VPN routes imported into a VRF because
a VRF can have other imported routes too like IPv4 and IPv6 unicast
routes sourced from EVPN type-2 and type-5 routes.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
vivek 2019-03-01 06:45:04 +00:00
parent f106e3a72d
commit 9544ddb288
2 changed files with 11 additions and 1 deletions

View File

@ -1355,7 +1355,10 @@ void vpn_leak_to_vrf_withdraw_all(struct bgp *bgp_vrf, /* to */
for (bpi = bgp_node_get_bgp_path_info(bn); bpi; for (bpi = bgp_node_get_bgp_path_info(bn); bpi;
bpi = bpi->next) { bpi = bpi->next) {
if (bpi->extra && bpi->extra->bgp_orig != bgp_vrf) { if (bpi->extra
&& bpi->extra->bgp_orig != bgp_vrf
&& bpi->extra->parent
&& is_pi_family_vpn(bpi->extra->parent)) {
/* delete route */ /* delete route */
bgp_aggregate_decrement(bgp_vrf, &bn->p, bpi, bgp_aggregate_decrement(bgp_vrf, &bn->p, bpi,

View File

@ -252,6 +252,13 @@ static inline bool is_route_injectable_into_vpn(struct bgp_path_info *pi)
return true; return true;
} }
/* Flag if the route path's family is VPN. */
static inline bool is_pi_family_vpn(struct bgp_path_info *pi)
{
return (is_pi_family_matching(pi, AFI_IP, SAFI_MPLS_VPN) ||
is_pi_family_matching(pi, AFI_IP6, SAFI_MPLS_VPN));
}
extern void vpn_policy_routemap_event(const char *rmap_name); extern void vpn_policy_routemap_event(const char *rmap_name);
extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey); extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey);