diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-10-29 17:52:52 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2020-07-02 08:17:51 +0200 |
commit | 044307285ba23da01177db02d25e84c35e0bcdac (patch) | |
tree | 929ca296ed87f2cb3cabb762b03ca63ba46df23d /bgpd/bgp_main.c | |
parent | bgpd: ability to remove rpki contexts from vty (diff) | |
download | frr-044307285ba23da01177db02d25e84c35e0bcdac.tar.xz frr-044307285ba23da01177db02d25e84c35e0bcdac.zip |
bgpd: add a hook to inform a vrf is enabled/disabled
this hook can be used by plugins like rpki.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r-- | bgpd/bgp_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 33eaf9ae7..a5826527c 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -65,6 +65,9 @@ #include "bgpd/rfapi/rfapi_backend.h" #endif +DEFINE_HOOK(bgp_hook_vrf_update, (struct vrf *vrf, bool enabled), + (vrf, enabled)) + /* bgpd options, we use GNU getopt library. */ static const struct option longopts[] = { {"bgp_port", required_argument, NULL, 'p'}, @@ -302,6 +305,7 @@ static int bgp_vrf_enable(struct vrf *vrf) if (old_vrf_id != bgp->vrf_id) bgp_redistribute_redo(bgp); bgp_instance_up(bgp); + hook_call(bgp_hook_vrf_update, vrf, true); vpn_leak_zebra_vrf_label_update(bgp, AFI_IP); vpn_leak_zebra_vrf_label_update(bgp, AFI_IP6); vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, @@ -351,6 +355,7 @@ static int bgp_vrf_disable(struct vrf *vrf) if (old_vrf_id != bgp->vrf_id) bgp_unset_redist_vrf_bitmaps(bgp, old_vrf_id); bgp_instance_down(bgp); + hook_call(bgp_hook_vrf_update, vrf, false); } /* Note: This is a callback, the VRF will be deleted by the caller. */ |