diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-01-22 15:16:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-22 15:16:34 +0100 |
commit | 20ec72d7ca84c38894ac8799c4f86bc0fe914a3d (patch) | |
tree | 6c334245401005892300049742ce31930ba2f3ec /vtysh | |
parent | Merge pull request #15176 from LabNConsulting/chopps/mgmtd-northbound-fixes (diff) | |
parent | topotests: add vrf test to bgp_rpki_topo1 (diff) | |
download | frr-20ec72d7ca84c38894ac8799c4f86bc0fe914a3d.tar.xz frr-20ec72d7ca84c38894ac8799c4f86bc0fe914a3d.zip |
Merge pull request #15052 from louis-6wind/rpki-vrf-92
bgpd: add VRF support to RPKI
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 19 | ||||
-rw-r--r-- | vtysh/vtysh.h | 2 | ||||
-rw-r--r-- | vtysh/vtysh_config.c | 11 |
3 files changed, 29 insertions, 3 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index d5ac87eb3..3109f1510 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1625,6 +1625,14 @@ static struct cmd_node rpki_node = { .parent_node = CONFIG_NODE, .prompt = "%s(config-rpki)# ", }; + +static struct cmd_node rpki_vrf_node = { + .name = "rpki", + .node = RPKI_VRF_NODE, + .parent_node = VRF_NODE, + .prompt = "%s(config-vrf-rpki)# ", +}; + #endif /* HAVE_BGPD */ #if HAVE_BFDD > 0 @@ -1855,7 +1863,10 @@ DEFUNSH(VTYSH_BGPD, "rpki", "Enable rpki and enter rpki configuration mode\n") { - vty->node = RPKI_NODE; + if (vty->node == CONFIG_NODE) + vty->node = RPKI_NODE; + else + vty->node = RPKI_VRF_NODE; return CMD_SUCCESS; } @@ -5071,6 +5082,12 @@ void vtysh_init_vty(void) install_element(VRF_NODE, &vtysh_exit_vrf_cmd); install_element(VRF_NODE, &vtysh_quit_vrf_cmd); + install_node(&rpki_vrf_node); + install_element(VRF_NODE, &rpki_cmd); + install_element(RPKI_VRF_NODE, &rpki_exit_cmd); + install_element(RPKI_VRF_NODE, &rpki_quit_cmd); + install_element(RPKI_VRF_NODE, &vtysh_end_all_cmd); + install_element(CONFIG_NODE, &vtysh_affinity_map_cmd); install_element(CONFIG_NODE, &vtysh_no_affinity_map_cmd); diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h index 11751d027..f63d4be6e 100644 --- a/vtysh/vtysh.h +++ b/vtysh/vtysh.h @@ -58,7 +58,7 @@ extern struct event_loop *master; VTYSH_EIGRPD | VTYSH_BABELD | VTYSH_PBRD | VTYSH_FABRICD | \ VTYSH_VRRPD | VTYSH_MGMTD #define VTYSH_INTERFACE VTYSH_INTERFACE_SUBSET | VTYSH_BGPD -#define VTYSH_VRF VTYSH_INTERFACE_SUBSET +#define VTYSH_VRF VTYSH_INTERFACE_SUBSET | RPKI_VRF_NODE #define VTYSH_KEYS VTYSH_RIPD | VTYSH_EIGRPD | VTYSH_OSPF6D | VTYSH_OSPFD /* Daemons who can process nexthop-group configs */ #define VTYSH_NH_GROUP VTYSH_PBRD|VTYSH_SHARPD diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index c02f27c87..888f6a8c2 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -315,11 +315,20 @@ void vtysh_config_parse_line(void *arg, const char *line) } else if (!strncmp(line, " ip mroute", strlen(" ip mroute"))) { config_add_line_uniq_end(config->line, line); + } else if ((strncmp(line, " rpki", strlen(" rpki")) == + 0) && + config->index == VRF_NODE) { + config_add_line(config->line, line); + config->index = RPKI_VRF_NODE; } else if (config->index == RMAP_NODE || config->index == INTERFACE_NODE || config->index == VTY_NODE) config_add_line_uniq(config->line, line); - else if (config->index == NH_GROUP_NODE) { + else if (config->index == RPKI_VRF_NODE && + strncmp(line, " exit", strlen(" exit")) == 0) { + config_add_line(config->line, line); + config->index = VRF_NODE; + } else if (config->index == NH_GROUP_NODE) { if (strncmp(line, " resilient", strlen(" resilient")) == 0) config_add_line_head(config->line, |