From 55477c47ae1d16e79f26342257437ef582e24dd9 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 May 2024 10:51:03 +0200 Subject: [PATCH] fix Signed-off-by: Louis Scalbert --- bgpd/bgp_evpn_vty.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 846a82ba905d..d544a6ea2031 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -3102,7 +3102,7 @@ static void evpn_show_route_rd_all_macip(struct vty *vty, struct bgp *bgp, * If 'type' is non-zero, only routes matching that type are shown. */ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, - json_object *json, int detail, bool self_orig) + bool use_json, int detail, bool self_orig) { struct bgp_dest *rd_dest; struct bgp_table *table; @@ -3137,7 +3137,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, prefix_rd2str((struct prefix_rd *)rd_destp, rd_str, sizeof(rd_str), bgp->asnotation); - if (json) + if (use_json) json_rd = json_object_new_object(); rd_header = 1; @@ -3186,7 +3186,7 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, prefix_cnt++; } - if (json) { + if (use_json) { json_prefix = json_object_new_object(); json_paths = json_object_new_array(); json_object_string_addf(json_prefix, "prefix", @@ -3227,12 +3227,12 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, route_vty_out(vty, p, pi, 0, SAFI_EVPN, json_path, false); - if (json) + if (use_json) json_object_array_add(json_paths, json_path); } - if (json) { + if (use_json) { if (add_prefix_to_json) { json_object_object_add(json_prefix, "paths", @@ -3277,22 +3277,8 @@ static void evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, int bgp_evpn_show_all_routes(struct vty *vty, struct bgp *bgp, int type, bool use_json, int detail) { - json_object *json = NULL; - - if (use_json) - json = json_object_new_object(); + evpn_show_all_routes(vty, bgp, type, use_json, detail, false); - evpn_show_all_routes(vty, bgp, type, json, detail, false); - - if (use_json) - /* - * We are using no_pretty here because under extremely high - * settings (lots of routes with many different paths) this can - * save several minutes of output when FRR is run on older cpu's - * or more underperforming routers out there. So for route - * scale, we need to use no_pretty json. - */ - vty_json_no_pretty(vty, json); return CMD_SUCCESS; }