diff options
Diffstat (limited to 'pbrd')
| -rw-r--r-- | pbrd/pbr_vty.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index dddca1d720..ebcbbb7205 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -917,7 +917,6 @@ static void vty_json_pbrms(json_object *j, struct vty *vty, json_object *jpbrm, *nexthop_group; char *nhg_name = pbrms->nhgrp_name ? pbrms->nhgrp_name : pbrms->internal_nhg_name; - char buf[PREFIX_STRLEN]; char rbuf[64]; jpbrm = json_object_new_object(); @@ -953,13 +952,9 @@ static void vty_json_pbrms(json_object *j, struct vty *vty, json_object_string_add(jpbrm, "vrfName", pbrms->vrf_name); if (pbrms->src) - json_object_string_add( - jpbrm, "matchSrc", - prefix2str(pbrms->src, buf, sizeof(buf))); + json_object_string_addf(jpbrm, "matchSrc", "%pFX", pbrms->src); if (pbrms->dst) - json_object_string_add( - jpbrm, "matchDst", - prefix2str(pbrms->dst, buf, sizeof(buf))); + json_object_string_addf(jpbrm, "matchDst", "%pFX", pbrms->dst); if (pbrms->mark) json_object_int_add(jpbrm, "matchMark", pbrms->mark); if (pbrms->dsfield & PBR_DSFIELD_DSCP) @@ -1037,12 +1032,8 @@ DEFPY (show_pbr_map, vty_show_pbr_map(vty, pbrm, detail); } - if (j) { - vty_out(vty, "%s\n", - json_object_to_json_string_ext( - j, JSON_C_TO_STRING_PRETTY)); - json_object_free(j); - } + if (j) + vty_json(vty, j); return CMD_SUCCESS; } @@ -1064,11 +1055,7 @@ DEFPY(show_pbr_nexthop_group, if (j) { pbr_nht_json_nexthop_group(j, word); - vty_out(vty, "%s\n", - json_object_to_json_string_ext( - j, JSON_C_TO_STRING_PRETTY)); - - json_object_free(j); + vty_json(vty, j); } else pbr_nht_show_nexthop_group(vty, word); @@ -1142,12 +1129,8 @@ DEFPY (show_pbr_interface, } } - if (j) { - vty_out(vty, "%s\n", - json_object_to_json_string_ext( - j, JSON_C_TO_STRING_PRETTY)); - json_object_free(j); - } + if (j) + vty_json(vty, j); return CMD_SUCCESS; } |
