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);
}
/* 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);
}