]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix memory leak in vrf inst for evpn route
authorChirag Shah <chirag@cumulusnetworks.com>
Thu, 7 Nov 2019 23:09:23 +0000 (15:09 -0800)
committerChirag Shah <chirag@cumulusnetworks.com>
Mon, 11 Nov 2019 16:27:55 +0000 (08:27 -0800)
There is a memory leak of the bgp node (route node)
in bgp vrf rib table while processing evpn remote routes.

During the remote evpn route processing, a new route
is imported and created in per vrf bgp rib route table,
the refcount for the route node is incremented multiple
times.

Post evpn route creation, the bgp (route) node refcount needs
to be decremented.

Ticket:CM-26838,CM-27169
Reviewed By:CCR-9477
Testing Done:

Before fix:
----------
initial state:
TORC1#vtysh -c "show memory"
BGP node                      :      515    184
BGP route                     :      568    112

with 1 mac-ip route:
TORC1#vtysh -c "show memory"
BGP node                      :      524    184
BGP route                     :      583    112

withdraw 1 mac-ip route:
TORC1#vtysh -c "show memory"
BGP node                      :      520    184
BGP route                     :      568    112

After fix:
withdra 1 mac-ip route
TORC1#vtysh -c "show memory"
BGP node                      :      515    184
BGP route                     :      568    112

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
bgpd/bgp_evpn.c

index c55d45180e12519b3b6d714bfaa27747286b3f17..625b13a9418f2f9f4b6196d5ed78371fbfdd641a 100644 (file)
@@ -2583,6 +2583,8 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
        /* Process for route leaking. */
        vpn_leak_from_vrf_update(bgp_get_default(), bgp_vrf, pi);
 
+       bgp_unlock_node(rn);
+
        return ret;
 }