diff options
Diffstat (limited to 'ospfd/ospf_vty.c')
| -rw-r--r-- | ospfd/ospf_vty.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 1d4aa65355..3ae9707f5f 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -10607,11 +10607,9 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, prefix2str(&rn->p, buf1, sizeof(buf1)); - json_route = json_object_new_object(); if (json) { + json_route = json_object_new_object(); json_object_object_add(json, buf1, json_route); - json_object_to_json_string_ext( - json, JSON_C_TO_STRING_NOSLASHESCAPE); } switch (or->path_type) { @@ -10733,8 +10731,6 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf, } } } - if (!json) - json_object_free(json_route); } if (!json) vty_out(vty, "\n"); @@ -10762,8 +10758,8 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, continue; int flag = 0; - json_route = json_object_new_object(); if (json) { + json_route = json_object_new_object(); json_object_object_add( json, inet_ntop(AF_INET, &rn->p.u.prefix4, buf, sizeof(buf)), @@ -10878,8 +10874,6 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf, } } } - if (!json) - json_object_free(json_route); } if (!json) vty_out(vty, "\n"); @@ -10908,11 +10902,9 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, char buf1[19]; snprintfrr(buf1, sizeof(buf1), "%pFX", &rn->p); - json_route = json_object_new_object(); if (json) { + json_route = json_object_new_object(); json_object_object_add(json, buf1, json_route); - json_object_to_json_string_ext( - json, JSON_C_TO_STRING_NOSLASHESCAPE); } switch (er->path_type) { @@ -11010,8 +11002,6 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf, } } } - if (!json) - json_object_free(json_route); } if (!json) vty_out(vty, "\n"); @@ -11224,7 +11214,9 @@ DEFUN (show_ip_ospf_route, if (uj) { /* Keep Non-pretty format */ vty_out(vty, "%s\n", - json_object_to_json_string(json)); + json_object_to_json_string_ext( + json, + JSON_C_TO_STRING_NOSLASHESCAPE)); json_object_free(json); } else if (!ospf_output) vty_out(vty, "%% OSPF instance not found\n"); @@ -11236,7 +11228,9 @@ DEFUN (show_ip_ospf_route, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, + JSON_C_TO_STRING_PRETTY + | JSON_C_TO_STRING_NOSLASHESCAPE)); json_object_free(json); } else vty_out(vty, "%% OSPF instance not found\n"); @@ -11250,7 +11244,9 @@ DEFUN (show_ip_ospf_route, if (uj) { vty_out(vty, "%s\n", json_object_to_json_string_ext( - json, JSON_C_TO_STRING_PRETTY)); + json, + JSON_C_TO_STRING_PRETTY + | JSON_C_TO_STRING_NOSLASHESCAPE)); json_object_free(json); } else vty_out(vty, "%% OSPF instance not found\n"); @@ -11263,7 +11259,9 @@ DEFUN (show_ip_ospf_route, ret = show_ip_ospf_route_common(vty, ospf, json, use_vrf); /* Keep Non-pretty format */ if (uj) - vty_out(vty, "%s\n", json_object_to_json_string(json)); + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_NOSLASHESCAPE)); } if (uj) |
