summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorLouis Scalbert <louis.scalbert@6wind.com>2023-06-07 15:15:30 +0200
committerLouis Scalbert <louis.scalbert@6wind.com>2023-06-16 14:18:25 +0200
commita04d32b36649c0e14c76ec121d17a46d95db5697 (patch)
tree7fe4522f195045139fbaed616ac2d5cd984b093d /bgpd
parentaf79038c4be1b5cec7da9f67b81280d6f14e2479 (diff)
bgpd: fix incorrect json output in bgp_show_table_rd()
'{}' extra output may present JSON output from bgp_show_table_rd() when no prefix are seen. > { > "vrfId": 0, > "vrfName": "default", > "tableVersion": 0, > "routerId": "1.1.1.1", > "defaultLocPrf": 100, > "localAS": 65500, > "routes": { "routeDistinguishers" : { "444:1" : { } } } } > {} Do not output '{}' when bgp_show_table() returns a valid JSON. Tested without rd in config, bgp_show_table() returns nothing and the JSON output is only '{}' Fixes: 0224b3296c ("bgpd: Print empty JSON `{}` if no entries under `show bgp ipv4 vpn json`") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 5285a221e2..058f57177a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -11783,7 +11783,7 @@ int bgp_show_table_rd(struct vty *vty, struct bgp *bgp, safi_t safi,
"\nDisplayed %ld routes and %ld total paths\n",
output_cum, total_cum);
} else {
- if (use_json && output_cum == 0)
+ if (use_json && output_cum == 0 && json_header_depth == 0)
vty_out(vty, "{}\n");
}
return CMD_SUCCESS;