bgpd: Cleanup rpki indentation

Rework a couple functions to allow the indentation to be a bit
cleaner.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2020-11-20 08:44:25 -05:00
parent 2332790973
commit 708b805361

View File

@ -900,7 +900,9 @@ static int config_write(struct vty *vty)
struct listnode *cache_node; struct listnode *cache_node;
struct cache *cache; struct cache *cache;
if (listcount(cache_list)) { if (!listcount(cache_list))
return 0;
if (rpki_debug) if (rpki_debug)
vty_out(vty, "debug rpki\n"); vty_out(vty, "debug rpki\n");
@ -915,8 +917,8 @@ static int config_write(struct vty *vty)
#endif #endif
case TCP: case TCP:
tcp_config = cache->tr_config.tcp_config; tcp_config = cache->tr_config.tcp_config;
vty_out(vty, " rpki cache %s %s ", vty_out(vty, " rpki cache %s %s ", tcp_config->host,
tcp_config->host, tcp_config->port); tcp_config->port);
break; break;
#if defined(FOUND_SSH) #if defined(FOUND_SSH)
case SSH: case SSH:
@ -926,8 +928,7 @@ static int config_write(struct vty *vty)
ssh_config->username, ssh_config->username,
ssh_config->client_privkey_path, ssh_config->client_privkey_path,
ssh_config->server_hostkey_path != NULL ssh_config->server_hostkey_path != NULL
? ssh_config ? ssh_config->server_hostkey_path
->server_hostkey_path
: " "); : " ");
break; break;
#endif #endif
@ -938,10 +939,8 @@ static int config_write(struct vty *vty)
vty_out(vty, "preference %hhu\n", cache->preference); vty_out(vty, "preference %hhu\n", cache->preference);
} }
vty_out(vty, " exit\n"); vty_out(vty, " exit\n");
return 1; return 1;
} else {
return 0;
}
} }
DEFUN_NOSH (rpki, DEFUN_NOSH (rpki,
@ -1275,7 +1274,12 @@ DEFUN (show_rpki_cache_connection,
RPKI_OUTPUT_STRING RPKI_OUTPUT_STRING
"Show to which RPKI Cache Servers we have a connection\n") "Show to which RPKI Cache Servers we have a connection\n")
{ {
if (is_synchronized()) { if (!is_synchronized()) {
vty_out(vty, "No connection to RPKI cache server.\n");
return CMD_SUCCESS;
}
struct listnode *cache_node; struct listnode *cache_node;
struct cache *cache; struct cache *cache;
struct rtr_mgr_group *group = get_connected_group(); struct rtr_mgr_group *group = get_connected_group();
@ -1294,23 +1298,17 @@ DEFUN (show_rpki_cache_connection,
switch (cache->type) { switch (cache->type) {
case TCP: case TCP:
tcp_config = tcp_config = cache->tr_config.tcp_config;
cache->tr_config.tcp_config; vty_out(vty, "rpki tcp cache %s %s pref %hhu\n",
vty_out(vty, tcp_config->host, tcp_config->port,
"rpki tcp cache %s %s pref %hhu\n",
tcp_config->host,
tcp_config->port,
cache->preference); cache->preference);
break; break;
#if defined(FOUND_SSH) #if defined(FOUND_SSH)
case SSH: case SSH:
ssh_config = ssh_config = cache->tr_config.ssh_config;
cache->tr_config.ssh_config; vty_out(vty, "rpki ssh cache %s %u pref %hhu\n",
vty_out(vty, ssh_config->host, ssh_config->port,
"rpki ssh cache %s %u pref %hhu\n",
ssh_config->host,
ssh_config->port,
cache->preference); cache->preference);
break; break;
#endif #endif
@ -1320,9 +1318,6 @@ DEFUN (show_rpki_cache_connection,
} }
} }
} }
} else {
vty_out(vty, "No connection to RPKI cache server.\n");
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }