]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Correctly identify VPN-imported routes in a VRF
authorvivek <vivek@cumulusnetworks.com>
Fri, 1 Mar 2019 06:45:04 +0000 (06:45 +0000)
committervivek <vivek@cumulusnetworks.com>
Fri, 1 Mar 2019 06:45:04 +0000 (06:45 +0000)
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>
bgpd/bgp_mplsvpn.c
bgpd/bgp_mplsvpn.h

index 39b0e2f1c8dfae508163492cdcfbfe5e3cb7dd52..2d3ff8b69564d67b43a5435fcdd4a40b44e46f7c 100644 (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;
                     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,
index c557b784af854711fab3c9b714516fd0ed149db8..2ef9570aac1f128f217dca30f8c8969e1c8fab3e 100644 (file)
@@ -252,6 +252,13 @@ static inline bool is_route_injectable_into_vpn(struct bgp_path_info *pi)
        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);