diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-09-19 16:37:14 +0200 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2020-07-02 08:17:51 +0200 |
commit | fd1be68353b7cf3077f6a2b905d73ec5355db644 (patch) | |
tree | f3e30ab0882eb99cacb3542b449d2061d05b95a9 /bgpd/bgp_main.c | |
parent | bgpd: duplicate config commands into rpki-vrf subnode (diff) | |
download | frr-fd1be68353b7cf3077f6a2b905d73ec5355db644.tar.xz frr-fd1be68353b7cf3077f6a2b905d73ec5355db644.zip |
bgpd: add hook for running-config per vrf rpki config
rpki config can be displayed in the 'show running-config'.
there is a fix to be done yet, this is related to the order of rpki per
vrf configuration. actually, the output is not saveable in the
running-config since the rpki commands are swapped. this prevents from
running rpki config at startup.
That commit also changes the identation, since rpki configure node was
with one extra space. reducing this, and add the changes for vrf
configuration too.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r-- | bgpd/bgp_main.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index a5826527c..ebf2328a7 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -61,6 +61,9 @@ #include "bgpd/bgp_network.h" #include "bgpd/bgp_errors.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 @@ -362,10 +365,30 @@ 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, bgp_vrf_enable); + vrf_cmd_init(bgp_vrf_config_write, &bgpd_privs); } static void bgp_vrf_terminate(void) |