ospf6d: Replace inet_ntop to %pI4/6 for JSON outputs

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2021-11-18 10:57:55 +02:00
parent 20308be317
commit ce4b236f61
2 changed files with 11 additions and 16 deletions

View File

@ -142,19 +142,15 @@ static int ospf6_router_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
json_object_string_add(json_loop, "type", name);
json_object_int_add(json_loop, "metric",
ntohs(lsdesc->metric));
json_object_string_add(json_loop, "interfaceId",
inet_ntop(AF_INET,
&lsdesc->interface_id,
buf, sizeof(buf)));
json_object_string_add(
json_loop, "neighborInterfaceId",
inet_ntop(AF_INET,
&lsdesc->neighbor_interface_id, buf,
sizeof(buf)));
json_object_string_add(
json_loop, "neighborRouterId",
inet_ntop(AF_INET, &lsdesc->neighbor_router_id,
buf, sizeof(buf)));
json_object_string_addf(
json_loop, "interfaceId", "%pI4",
(in_addr_t *)&lsdesc->interface_id);
json_object_string_addf(
json_loop, "neighborInterfaceId", "%pI4",
(in_addr_t *)&lsdesc->neighbor_interface_id);
json_object_string_addf(json_loop, "neighborRouterId",
"%pI4",
&lsdesc->neighbor_router_id);
json_object_array_add(json_arr, json_loop);
} else {
vty_out(vty, " Type: %s Metric: %d\n", name,

View File

@ -1482,9 +1482,8 @@ DEFUN(show_ipv6_ospf6_vrfs, show_ipv6_ospf6_vrfs_cmd,
if (uj) {
json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
json_object_string_add(json_vrf, "routerId",
inet_ntop(AF_INET, &router_id,
buf, sizeof(buf)));
json_object_string_addf(json_vrf, "routerId", "%pI4",
&router_id);
json_object_object_add(json_vrfs, name, json_vrf);
} else {