Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed May 27, 2024
1 parent 6465567 commit 55477c4
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions bgpd/bgp_evpn_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 55477c4

Please sign in to comment.