summaryrefslogtreecommitdiff
path: root/lib/nexthop_group.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nexthop_group.c')
-rw-r--r--lib/nexthop_group.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index af9cd2d79a..774d03079a 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -1046,26 +1046,18 @@ void nexthop_group_json_nexthop(json_object *j, const struct nexthop *nh)
ifindex2ifname(nh->ifindex, nh->vrf_id));
break;
case NEXTHOP_TYPE_IPV4:
- json_object_string_add(
- j, "nexthop",
- inet_ntop(AF_INET, &nh->gate.ipv4, buf, sizeof(buf)));
+ json_object_string_addf(j, "nexthop", "%pI4", &nh->gate.ipv4);
break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
- json_object_string_add(
- j, "nexthop",
- inet_ntop(AF_INET, &nh->gate.ipv4, buf, sizeof(buf)));
+ json_object_string_addf(j, "nexthop", "%pI4", &nh->gate.ipv4);
json_object_string_add(j, "vrfId",
ifindex2ifname(nh->ifindex, nh->vrf_id));
break;
case NEXTHOP_TYPE_IPV6:
- json_object_string_add(
- j, "nexthop",
- inet_ntop(AF_INET6, &nh->gate.ipv6, buf, sizeof(buf)));
+ json_object_string_addf(j, "nexthop", "%pI6", &nh->gate.ipv6);
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
- json_object_string_add(
- j, "nexthop",
- inet_ntop(AF_INET6, &nh->gate.ipv6, buf, sizeof(buf)));
+ json_object_string_addf(j, "nexthop", "%pI6", &nh->gate.ipv6);
json_object_string_add(j, "vrfId",
ifindex2ifname(nh->ifindex, nh->vrf_id));
break;