summaryrefslogtreecommitdiff
path: root/bgpd/bgpd.h
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-05-21 08:51:03 -0700
committerPaul Jakma <paul@quagga.net>2009-06-18 20:18:28 +0100
commit0088b5dc55a91d27e572484e61df71b8ca2eddf4 (patch)
treef93714f98d12890f961794cd026b6bf2de75105e /bgpd/bgpd.h
parentdde7258666fd73878b4cc10b4b5b7c07e9be049e (diff)
[bgpd] reference count the BGP instance
When a BGP instance is deleted with lots of routes and neighbors it is possible for the peer rsclient queue to run after bgp_delete has been called. This would lead to bgpd crashing, see https://bugzilla.vyatta.com/show_bug.cgi?id=3436 The fix is to add reference counting to the BGP instance and defer actual freeing until all references are gone. This patch also fixes a memory leak where the self-reference peer instance was being created but never freed. The check in bgp_clear_route is no longer valid because it is possible for it to be called when peer is in Deleted state during cleanup.
Diffstat (limited to 'bgpd/bgpd.h')
-rw-r--r--bgpd/bgpd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index afe06635..e8b8ef5a 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -70,6 +70,9 @@ struct bgp
/* Name of this BGP instance. */
char *name;
+ /* Reference count to allow peer_delete to finish after bgp_delete */
+ int lock;
+
/* Self peer. */
struct peer *peer_self;
@@ -843,6 +846,9 @@ extern int bgp_flag_set (struct bgp *, int);
extern int bgp_flag_unset (struct bgp *, int);
extern int bgp_flag_check (struct bgp *, int);
+extern void bgp_lock (struct bgp *);
+extern void bgp_unlock (struct bgp *);
+
extern int bgp_router_id_set (struct bgp *, struct in_addr *);
extern int bgp_cluster_id_set (struct bgp *, struct in_addr *);