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_string_add(json_loop, "type", name);
json_object_int_add(json_loop, "metric", json_object_int_add(json_loop, "metric",
ntohs(lsdesc->metric)); ntohs(lsdesc->metric));
json_object_string_add(json_loop, "interfaceId", json_object_string_addf(
inet_ntop(AF_INET, json_loop, "interfaceId", "%pI4",
&lsdesc->interface_id, (in_addr_t *)&lsdesc->interface_id);
buf, sizeof(buf))); json_object_string_addf(
json_object_string_add( json_loop, "neighborInterfaceId", "%pI4",
json_loop, "neighborInterfaceId", (in_addr_t *)&lsdesc->neighbor_interface_id);
inet_ntop(AF_INET, json_object_string_addf(json_loop, "neighborRouterId",
&lsdesc->neighbor_interface_id, buf, "%pI4",
sizeof(buf))); &lsdesc->neighbor_router_id);
json_object_string_add(
json_loop, "neighborRouterId",
inet_ntop(AF_INET, &lsdesc->neighbor_router_id,
buf, sizeof(buf)));
json_object_array_add(json_arr, json_loop); json_object_array_add(json_arr, json_loop);
} else { } else {
vty_out(vty, " Type: %s Metric: %d\n", name, 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) { if (uj) {
json_object_int_add(json_vrf, "vrfId", vrf_id_ui); json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
json_object_string_add(json_vrf, "routerId", json_object_string_addf(json_vrf, "routerId", "%pI4",
inet_ntop(AF_INET, &router_id, &router_id);
buf, sizeof(buf)));
json_object_object_add(json_vrfs, name, json_vrf); json_object_object_add(json_vrfs, name, json_vrf);
} else { } else {