forked from Mirror/frr
bgpd: Add no rpki
command
To delete the whole RPKI section. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
2af482767c
commit
8156765abe
|
@ -120,6 +120,7 @@ static int add_ssh_cache(const char *host, const unsigned int port,
|
||||||
#endif
|
#endif
|
||||||
static struct rtr_socket *create_rtr_socket(struct tr_socket *tr_socket);
|
static struct rtr_socket *create_rtr_socket(struct tr_socket *tr_socket);
|
||||||
static struct cache *find_cache(const uint8_t preference);
|
static struct cache *find_cache(const uint8_t preference);
|
||||||
|
static void rpki_delete_all_cache_nodes(void);
|
||||||
static int add_tcp_cache(const char *host, const char *port,
|
static int add_tcp_cache(const char *host, const char *port,
|
||||||
const uint8_t preference, const char *bindaddr);
|
const uint8_t preference, const char *bindaddr);
|
||||||
static void print_record(const struct pfx_record *record, struct vty *vty,
|
static void print_record(const struct pfx_record *record, struct vty *vty,
|
||||||
|
@ -276,6 +277,17 @@ static struct cache *find_cache(const uint8_t preference)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rpki_delete_all_cache_nodes(void)
|
||||||
|
{
|
||||||
|
struct listnode *cache_node, *cache_next;
|
||||||
|
struct cache *cache;
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS(cache_list, cache_node, cache_next, cache)) {
|
||||||
|
rtr_mgr_remove_group(rtr_config, cache->preference);
|
||||||
|
listnode_delete(cache_list, cache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void print_record(const struct pfx_record *record, struct vty *vty,
|
static void print_record(const struct pfx_record *record, struct vty *vty,
|
||||||
json_object *json)
|
json_object *json)
|
||||||
{
|
{
|
||||||
|
@ -1055,6 +1067,17 @@ DEFUN_NOSH (rpki,
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFPY (no_rpki,
|
||||||
|
no_rpki_cmd,
|
||||||
|
"no rpki",
|
||||||
|
NO_STR
|
||||||
|
"Enable rpki and enter rpki configuration mode\n")
|
||||||
|
{
|
||||||
|
rpki_delete_all_cache_nodes();
|
||||||
|
stop();
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
DEFUN (bgp_rpki_start,
|
DEFUN (bgp_rpki_start,
|
||||||
bgp_rpki_start_cmd,
|
bgp_rpki_start_cmd,
|
||||||
"rpki start",
|
"rpki start",
|
||||||
|
@ -1662,6 +1685,8 @@ static void install_cli_commands(void)
|
||||||
install_default(RPKI_NODE);
|
install_default(RPKI_NODE);
|
||||||
install_element(CONFIG_NODE, &rpki_cmd);
|
install_element(CONFIG_NODE, &rpki_cmd);
|
||||||
install_element(ENABLE_NODE, &rpki_cmd);
|
install_element(ENABLE_NODE, &rpki_cmd);
|
||||||
|
install_element(CONFIG_NODE, &no_rpki_cmd);
|
||||||
|
|
||||||
|
|
||||||
install_element(ENABLE_NODE, &bgp_rpki_start_cmd);
|
install_element(ENABLE_NODE, &bgp_rpki_start_cmd);
|
||||||
install_element(ENABLE_NODE, &bgp_rpki_stop_cmd);
|
install_element(ENABLE_NODE, &bgp_rpki_stop_cmd);
|
||||||
|
|
Loading…
Reference in a new issue