summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgpd.c9
-rw-r--r--bgpd/bgpd.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index cb90d39266..d79a68dcab 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -94,6 +94,10 @@ DEFINE_MTYPE_STATIC(BGPD, BGP_EVPN_INFO, "BGP EVPN instance information");
DEFINE_QOBJ_TYPE(bgp_master)
DEFINE_QOBJ_TYPE(bgp)
DEFINE_QOBJ_TYPE(peer)
+DEFINE_HOOK(bgp_inst_delete, (struct bgp *bgp), (bgp))
+DEFINE_HOOK(bgp_inst_config_write,
+ (struct bgp *bgp, struct vty *vty),
+ (bgp, vty))
/* BGP process wide configuration. */
static struct bgp_master bgp_master;
@@ -3286,6 +3290,9 @@ int bgp_delete(struct bgp *bgp)
int i;
assert(bgp);
+
+ hook_call(bgp_inst_delete, bgp);
+
THREAD_OFF(bgp->t_startup);
THREAD_OFF(bgp->t_maxmed_onstartup);
THREAD_OFF(bgp->t_update_delay);
@@ -7797,6 +7804,8 @@ int bgp_config_write(struct vty *vty)
/* EVPN configuration. */
bgp_config_write_family(vty, bgp, AFI_L2VPN, SAFI_EVPN);
+ hook_call(bgp_inst_config_write, bgp, vty);
+
#if ENABLE_BGP_VNC
bgp_rfapi_cfg_write(vty, bgp);
#endif
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index c329c8a7ea..777db0ce22 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -24,6 +24,7 @@
#include "qobj.h"
#include <pthread.h>
+#include "hook.h"
#include "frr_pthread.h"
#include "lib/json.h"
#include "vrf.h"
@@ -572,6 +573,11 @@ struct bgp {
};
DECLARE_QOBJ_TYPE(bgp)
+DECLARE_HOOK(bgp_inst_delete, (struct bgp *bgp), (bgp))
+DECLARE_HOOK(bgp_inst_config_write,
+ (struct bgp *bgp, struct vty *vty),
+ (bgp, vty))
+
#define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold)
#define IS_BGP_INST_KNOWN_TO_ZEBRA(bgp) \