diff --git a/debian/changelog b/debian/changelog index 83b9077365c7..49a45e15ab68 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +frr (8.4.2-6-aka1~deb11u1) bullseye; urgency=low + + * Applied patch: fix for CLIC-271 + + -- Piotr Suchy Tue, 02 Apr 2024 15:33:15 +0200 + frr (8.4.2-5-aka1~deb11u1) bullseye; urgency=medium * Applied patch: mdjernae, BGP12 issue fix diff --git a/lib/vty.c b/lib/vty.c index 5fe8a7955bbe..fb547f0c7d33 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -281,6 +281,22 @@ int vty_out(struct vty *vty, const char *format, ...) return len; } +static int vty_json_helper(struct vty *vty, struct json_object *json, + uint32_t options) +{ + const char *text; + + if (!json) + return CMD_SUCCESS; + + text = json_object_to_json_string_ext( + json, options); + vty_out(vty, "%s\n", text); + json_object_free(json); + + return CMD_SUCCESS; +} + int vty_json(struct vty *vty, struct json_object *json) { const char *text; @@ -296,6 +312,11 @@ int vty_json(struct vty *vty, struct json_object *json) return CMD_SUCCESS; } +int vty_json_no_pretty(struct vty *vty, struct json_object *json) +{ + return vty_json_helper(vty, json, JSON_C_TO_STRING_NOSLASHESCAPE); +} + /* Output current time to the vty. */ void vty_time_print(struct vty *vty, int cr) { diff --git a/lib/vty.h b/lib/vty.h index 430579c5a877..0bc99bcd1d0e 100644 --- a/lib/vty.h +++ b/lib/vty.h @@ -350,6 +350,7 @@ extern bool vty_set_include(struct vty *vty, const char *regexp); * NULL check and json_object_free() is included. */ extern int vty_json(struct vty *vty, struct json_object *json); +extern int vty_json_no_pretty(struct vty *vty, struct json_object *json); /* post fd to be passed to the vtysh client * fd is owned by the VTY code after this and will be closed when done diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 47eb4d2730e9..2d63e740eb73 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1295,7 +1295,7 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, } if (use_json && !vrf_json) { - vty_json(vty, json); + vty_json_no_pretty(vty, json); json = NULL; } } @@ -1952,7 +1952,7 @@ DEFPY (show_route, json_object_object_add(root_json, zvrf_name(zvrf), vrf_json); } if (!!json) { - vty_json(vty, root_json); + vty_json_no_pretty(vty, root_json); root_json = NULL; } } else {