summaryrefslogtreecommitdiffstats
path: root/bgpd/bgpd.h
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgpd.h')
-rw-r--r--bgpd/bgpd.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 0cd88d81..84164593 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;
@@ -897,6 +900,19 @@ bgp_config_check (const struct bgp *bgp, int config)
return CHECK_FLAG (bgp->config, config);
}
+static inline void
+bgp_lock(struct bgp *bgp)
+{
+ ++bgp->lock;
+}
+
+static inline void
+bgp_unlock(struct bgp *bgp)
+{
+ if (--bgp->lock == 0)
+ bgp_free (bgp);
+}
+
extern int bgp_router_id_set (struct bgp *, struct in_addr *);
extern int bgp_cluster_id_set (struct bgp *, struct in_addr *);