summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2019-11-05 18:30:56 -0800
committerChirag Shah <chirag@cumulusnetworks.com>2019-11-11 08:27:37 -0800
commita97a1e11449bb21d74c69ac0d130439430484df0 (patch)
tree48d4e723c81cfda2df9e61d07690f5ed0d82a7cc
parenta5f271c6352a278856c8aa453d78c1dd65ca2638 (diff)
bgpd: fix memory leak in vni table for evpn routes
There is a memory leak of the bgp node (route node) in vni table while processing evpn remote route(s). During the remote evpn route processing, a new route is created in per vni route table, the refcount for the route node is incremented twice. First refcount is incremented during the node creation and the second one when the bgp_info_add is added. Post evpn route creation, the bgp node refcount needs to be decremented. Ticket:CM-26898,CM-26838,CM-27169 Reviewed By:CCR-9474 Testing Done: In EVPN topology send 1K MAC routes then check the memory footprint at the remote VTEP before sending 1K type-2 routes and after flushing/withdrawal of the routes. Before fix: ----------- Initial memory footprint: root@TOR1:~# vtysh -c "show memory" | grep "Hash Bucket \|BGP node \|BGP route" Hash Bucket : 2008 32 BGP node : 182 152 BGP route : 96 112 With 1K MAC (type-2 routes) root@TOR1:~# vtysh -c "show memory" | grep "Hash Bucket \|BGP node \|BGP route" Hash Bucket : 6008 32 BGP node : 4182 152 BGP route : 2096 112 After cleaning up 1K MAC entries from source VTEP which triggers BGP withdraw at the remote VTEP. root@TOR1:~# vtysh -c "show memory" | grep "Hash Bucket \|BGP node \|BGP route" Hash Bucket : 4008 32 BGP node : 2182 152 <-- Here 2K delta from initial count. BGP route : 96 112 With fix: --------- After 1K MAC entries cleaned up at the remote VTEP, the memory footprint (BGP Node and Hash Bucket count) is equilibrium to start of the test. root@TOR1:~# vtysh -c "show memory" | grep "Hash Bucket \|BGP node \|BGP route" Hash Bucket : 2008 32 BGP node : 182 152 BGP route : 96 112 Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_evpn.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 07d3f7b31e..c55d45180e 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -2638,6 +2638,8 @@ static int install_evpn_route_entry(struct bgp *bgp, struct bgpevpn *vpn,
/* Perform route selection and update zebra, if required. */
ret = evpn_route_select_install(bgp, vpn, rn);
+ bgp_unlock_node(rn);
+
return ret;
}