diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2021-11-18 10:58:23 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas.abraitis@gmail.com> | 2021-11-18 18:45:41 +0200 |
| commit | 08edf9c6af87489c06b7fe45f92d2be09e6622bc (patch) | |
| tree | 5ec31bcd90c8431708e074a992fb2cd5fdcc2767 /zebra/zebra_vty.c | |
| parent | b0d5264e3ff279414b7adb22f5e0ddf70d2c5773 (diff) | |
zebra: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'zebra/zebra_vty.c')
| -rw-r--r-- | zebra/zebra_vty.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 85e1a4b2bf..a3faa3d3e2 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -709,10 +709,8 @@ static void show_nexthop_json_helper(json_object *json_nexthop, switch (nexthop->type) { case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4_IFINDEX: - json_object_string_add( - json_nexthop, "ip", - inet_ntop(AF_INET, &nexthop->gate.ipv4, - buf, sizeof(buf))); + json_object_string_addf(json_nexthop, "ip", "%pI4", + &nexthop->gate.ipv4); json_object_string_add(json_nexthop, "afi", "ipv4"); @@ -729,10 +727,8 @@ static void show_nexthop_json_helper(json_object *json_nexthop, break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: - json_object_string_add( - json_nexthop, "ip", - inet_ntop(AF_INET6, &nexthop->gate.ipv6, - buf, sizeof(buf))); + json_object_string_addf(json_nexthop, "ip", "%pI6", + &nexthop->gate.ipv6); json_object_string_add(json_nexthop, "afi", "ipv6"); |
