summaryrefslogtreecommitdiff
path: root/bgpd/bgp_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r--bgpd/bgp_main.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 739fab7ddd..1666d654c5 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -51,6 +51,9 @@
#include "bgpd/bgp_routemap_nb.h"
#include "bgpd/bgp_community_alias.h"
+DEFINE_HOOK(bgp_hook_config_write_vrf, (struct vty *vty, struct vrf *vrf),
+ (vty, vrf));
+
#ifdef ENABLE_BGP_VNC
#include "bgpd/rfapi/rfapi_backend.h"
#endif
@@ -344,9 +347,29 @@ static int bgp_vrf_disable(struct vrf *vrf)
return 0;
}
+static int bgp_vrf_config_write(struct vty *vty)
+{
+ struct vrf *vrf;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ if (vrf->vrf_id == VRF_DEFAULT) {
+ vty_out(vty, "!\n");
+ continue;
+ }
+ vty_out(vty, "vrf %s\n", vrf->name);
+
+ hook_call(bgp_hook_config_write_vrf, vty, vrf);
+
+ vty_out(vty, "exit-vrf\n!\n");
+ }
+
+ return 0;
+}
+
static void bgp_vrf_init(void)
{
vrf_init(bgp_vrf_new, bgp_vrf_enable, bgp_vrf_disable, bgp_vrf_delete);
+ vrf_cmd_init(bgp_vrf_config_write);
}
static void bgp_vrf_terminate(void)