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>
for (bpi = bgp_node_get_bgp_path_info(bn); bpi;
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 */
bgp_aggregate_decrement(bgp_vrf, &bn->p, bpi,
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 vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey);