summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index d300397b4e..8b5dbabb92 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1310,7 +1310,6 @@ static void connected_dump_vty(struct vty *vty, json_object *json,
{
struct prefix *p;
json_object *json_addr = NULL;
- char buf[PREFIX2STR_BUFFER];
/* Print interface address. */
p = connected->address;
@@ -1318,8 +1317,7 @@ static void connected_dump_vty(struct vty *vty, json_object *json,
if (json) {
json_addr = json_object_new_object();
json_object_array_add(json, json_addr);
- json_object_string_add(json_addr, "address",
- prefix2str(p, buf, sizeof(buf)));
+ json_object_string_addf(json_addr, "address", "%pFX", p);
} else {
vty_out(vty, " %s %pFX", prefix_family_str(p), p);
}
@@ -1327,10 +1325,8 @@ static void connected_dump_vty(struct vty *vty, json_object *json,
/* If there is destination address, print it. */
if (CONNECTED_PEER(connected) && connected->destination) {
if (json) {
- json_object_string_add(
- json_addr, "peer",
- prefix2str(connected->destination, buf,
- sizeof(buf)));
+ json_object_string_addf(json_addr, "peer", "%pFX",
+ connected->destination);
} else {
vty_out(vty, " peer %pFX", connected->destination);
}
@@ -2348,12 +2344,8 @@ DEFPY(show_interface, show_interface_cmd,
}
}
- if (json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}
@@ -2395,12 +2387,8 @@ DEFPY (show_interface_vrf_all,
}
}
- if (json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}
@@ -2448,12 +2436,8 @@ DEFPY (show_interface_name_vrf,
else
if_dump_vty(vty, ifp);
- if (json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}
@@ -2513,12 +2497,8 @@ DEFPY (show_interface_name_vrf_all,
else
if_dump_vty(vty, ifp);
- if (json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}