mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-01 12:47:16 +00:00
bgpd: running-config rpki indicates only non default values
the show running-config rpki was displaying systematically the default values, when at least one cache server was configured. now, if the rpki configuration has been changed, either because of a new cache server, or because of a change in the default settings, then the associated configuration is dumped in the 'show running-config' command. adding to this, to permit user to dump the settings values, the command 'show rpki configuration' dumps the values whatever default or not. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
416d0484c0
commit
f3517f58f1
@ -904,20 +904,36 @@ static void free_cache(struct cache *cache)
|
||||
XFREE(MTYPE_BGP_RPKI_CACHE, cache);
|
||||
}
|
||||
|
||||
|
||||
/* return true if config changed from default */
|
||||
static bool config_changed(void)
|
||||
{
|
||||
if (polling_period != POLLING_PERIOD_DEFAULT)
|
||||
return true;
|
||||
if (retry_interval != RETRY_INTERVAL_DEFAULT)
|
||||
return true;
|
||||
if (expire_interval != EXPIRE_INTERVAL_DEFAULT)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static int config_write(struct vty *vty)
|
||||
{
|
||||
struct listnode *cache_node;
|
||||
struct cache *cache;
|
||||
|
||||
if (listcount(cache_list)) {
|
||||
if (listcount(cache_list) && config_changed()) {
|
||||
if (rpki_debug)
|
||||
vty_out(vty, "debug rpki\n");
|
||||
|
||||
vty_out(vty, "!\n");
|
||||
vty_out(vty, "rpki\n");
|
||||
vty_out(vty, " rpki polling_period %d\n", polling_period);
|
||||
vty_out(vty, " rpki retry-interval %d\n", retry_interval);
|
||||
vty_out(vty, " rpki expire_interval %d\n", expire_interval)
|
||||
if (polling_period != POLLING_PERIOD_DEFAULT)
|
||||
vty_out(vty, " rpki polling_period %d\n", polling_period);
|
||||
if (retry_interval != RETRY_INTERVAL_DEFAULT)
|
||||
vty_out(vty, " rpki retry-interval %d\n", retry_interval);
|
||||
if (expire_interval != EXPIRE_INTERVAL_DEFAULT)
|
||||
vty_out(vty, " rpki expire_interval %d\n", expire_interval);
|
||||
for (ALL_LIST_ELEMENTS_RO(cache_list, cache_node, cache)) {
|
||||
switch (cache->type) {
|
||||
struct tr_tcp_config *tcp_config;
|
||||
@ -1423,6 +1439,25 @@ DEFUN (show_rpki_cache_connection,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (show_rpki_configuration,
|
||||
show_rpki_configuration_cmd,
|
||||
"show rpki configuration",
|
||||
SHOW_STR
|
||||
RPKI_OUTPUT_STRING
|
||||
"Show RPKI configuration\n")
|
||||
{
|
||||
vty_out(vty, "rpki is %s",
|
||||
listcount(cache_list) ? "Enabled" : "Disabled");
|
||||
if (!listcount(cache_list))
|
||||
return CMD_SUCCESS;
|
||||
vty_out(vty, " (%d cache servers configured)", listcount(cache_list));
|
||||
vty_out(vty, "\n");
|
||||
vty_out(vty, "\tpolling period %d\n", polling_period);
|
||||
vty_out(vty, "\tretry interval %d\n", retry_interval);
|
||||
vty_out(vty, "\texpire interval %d\n", expire_interval);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static int config_on_exit(struct vty *vty)
|
||||
{
|
||||
reset(false);
|
||||
@ -1564,6 +1599,7 @@ static void install_cli_commands(void)
|
||||
install_element(VIEW_NODE, &show_rpki_cache_server_cmd);
|
||||
install_element(VIEW_NODE, &show_rpki_prefix_cmd);
|
||||
install_element(VIEW_NODE, &show_rpki_as_number_cmd);
|
||||
install_element(VIEW_NODE, &show_rpki_configuration_cmd);
|
||||
|
||||
/* Install debug commands */
|
||||
install_element(CONFIG_NODE, &debug_rpki_cmd);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user