From: Donatas Abraitis Date: Sat, 3 Jul 2021 11:09:28 +0000 (+0300) Subject: zebra: Do not escape forward slashes for `show ip route json` X-Git-Tag: base_8.1~350^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=45c8ba8fb34aa8d24274af540c5bb6a8f4f7b857;p=matthieu%2Ffrr.git zebra: Do not escape forward slashes for `show ip route json` Basically, this is handled by JSON-C library. I've compiled with the latest release of json-c and it works well. Didn't test with various distribution versions, but this change is kinda dependend from the json-c lib version the distra has. Before: ``` "192.168.100.1\/32":[ { "prefix":"192.168.100.1\/32", ``` After: ``` "192.168.100.1/32":[ { "prefix":"192.168.100.1/32", ``` Signed-off-by: Donatas Abraitis --- diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 51f19a3c03..8cf783341c 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -1121,8 +1121,10 @@ static void vty_show_ip_route_detail_json(struct vty *vty, prefix2str(&rn->p, buf, sizeof(buf)); json_object_object_add(json, buf, json_prefix); - vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY + | JSON_C_TO_STRING_NOSLASHESCAPE)); json_object_free(json); } @@ -1234,8 +1236,11 @@ static void do_show_route_helper(struct vty *vty, struct zebra_vrf *zvrf, } if (use_json) { - vty_out(vty, "%s\n", json_object_to_json_string_ext(json, - JSON_C_TO_STRING_PRETTY)); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, + JSON_C_TO_STRING_PRETTY + | JSON_C_TO_STRING_NOSLASHESCAPE)); json_object_free(json); } }