@@ -120,6 +120,7 @@ static int add_ssh_cache(const char *host, const unsigned int port,
120
120
#endif
121
121
static struct rtr_socket * create_rtr_socket (struct tr_socket * tr_socket );
122
122
static struct cache * find_cache (const uint8_t preference );
123
+ static void rpki_delete_all_cache_nodes (void );
123
124
static int add_tcp_cache (const char * host , const char * port ,
124
125
const uint8_t preference , const char * bindaddr );
125
126
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)
276
277
return NULL ;
277
278
}
278
279
280
+ static void rpki_delete_all_cache_nodes (void )
281
+ {
282
+ struct listnode * cache_node , * cache_next ;
283
+ struct cache * cache ;
284
+
285
+ for (ALL_LIST_ELEMENTS (cache_list , cache_node , cache_next , cache )) {
286
+ rtr_mgr_remove_group (rtr_config , cache -> preference );
287
+ listnode_delete (cache_list , cache );
288
+ }
289
+ }
290
+
279
291
static void print_record (const struct pfx_record * record , struct vty * vty ,
280
292
json_object * json )
281
293
{
@@ -1055,6 +1067,17 @@ DEFUN_NOSH (rpki,
1055
1067
return CMD_SUCCESS ;
1056
1068
}
1057
1069
1070
+ DEFPY (no_rpki ,
1071
+ no_rpki_cmd ,
1072
+ "no rpki" ,
1073
+ NO_STR
1074
+ "Enable rpki and enter rpki configuration mode\n" )
1075
+ {
1076
+ rpki_delete_all_cache_nodes ();
1077
+ stop ();
1078
+ return CMD_SUCCESS ;
1079
+ }
1080
+
1058
1081
DEFUN (bgp_rpki_start ,
1059
1082
bgp_rpki_start_cmd ,
1060
1083
"rpki start" ,
@@ -1662,6 +1685,8 @@ static void install_cli_commands(void)
1662
1685
install_default (RPKI_NODE );
1663
1686
install_element (CONFIG_NODE , & rpki_cmd );
1664
1687
install_element (ENABLE_NODE , & rpki_cmd );
1688
+ install_element (CONFIG_NODE , & no_rpki_cmd );
1689
+
1665
1690
1666
1691
install_element (ENABLE_NODE , & bgp_rpki_start_cmd );
1667
1692
install_element (ENABLE_NODE , & bgp_rpki_stop_cmd );
0 commit comments