]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fix params/checks for route leaking and L3VPN
authorvivek <vivek@cumulusnetworks.com>
Tue, 27 Mar 2018 00:04:24 +0000 (17:04 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 25 Apr 2018 16:39:16 +0000 (12:39 -0400)
When routes are injected into the VPN table and then leaked into candidate
VRFs, the source should be the default instance. Also, the loop check when
withdrawing routes from a VRF should be that the route's origin isn't that
VRF; this handles VRF route leaking also and is consistent with checks in
other places.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
(cherry picked from commit 0149d2848c59bfb3277592caf0a5d5e07a2de872)

Ticket: CM-20256

bgpd/bgp_mplsvpn.c

index 5a12e12c774cff07c0ef0282a68b8b55bc9ec44e..e2cae067bf6b2fbf2f1b2688a86addb8c3610537 100644 (file)
@@ -834,7 +834,7 @@ void vpn_leak_from_vrf_update(struct bgp *bgp_vpn,       /* to */
         * because of loop checking.
         */
        if (new_info)
-               vpn_leak_to_vrf_update(bgp_vrf, new_info);
+               vpn_leak_to_vrf_update(bgp_vpn, new_info);
 }
 
 void vpn_leak_from_vrf_withdraw(struct bgp *bgp_vpn,       /* to */
@@ -1295,18 +1295,17 @@ void vpn_leak_to_vrf_withdraw_all(struct bgp *bgp_vrf, /* to */
        struct bgp_info *bi;
        safi_t safi = SAFI_UNICAST;
        int debug = BGP_DEBUG(vpn, VPN_LEAK_TO_VRF);
-       struct bgp *bgp_vpn = bgp_get_default();
 
        if (debug)
                zlog_debug("%s: entry", __func__);
        /*
-        * Walk vrf table, delete bi with bgp_orig == bgp_vpn
+        * Walk vrf table, delete bi with bgp_orig in a different vrf
         */
        for (bn = bgp_table_top(bgp_vrf->rib[afi][safi]); bn;
             bn = bgp_route_next(bn)) {
 
                for (bi = bn->info; bi; bi = bi->next) {
-                       if (bi->extra && bi->extra->bgp_orig == bgp_vpn) {
+                       if (bi->extra && bi->extra->bgp_orig != bgp_vrf) {
 
                                /* delete route */
                                bgp_aggregate_decrement(bgp_vrf, &bn->p, bi,