Skip to content

Commit

Permalink
bgpd: fix show rpki prefix-table json when disconnected
Browse files Browse the repository at this point in the history
When RPKI is not synchronized with the server, "show rpki prefix-table
json" returns no output.

Return "{}" instead in such a case.

Fixes: dff41cc ("bgpd: Add JSON output for `show rpki prefix` and other show commands")
Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Dec 15, 2023
1 parent a912f8f commit 9561c86
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,15 +1326,18 @@ DEFPY (show_rpki_prefix_table,
{
struct json_object *json = NULL;


if (uj)
json = json_object_new_object();

if (!is_synchronized()) {
if (!uj)
if (uj)
vty_json(vty, json);
else
vty_out(vty, "No connection to RPKI cache server.\n");
return CMD_WARNING;
}

if (uj)
json = json_object_new_object();

print_prefix_table(vty, json);
return CMD_SUCCESS;
}
Expand Down

0 comments on commit 9561c86

Please sign in to comment.