summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-11-18 22:19:40 +0300
committerGitHub <noreply@github.com>2021-11-18 22:19:40 +0300
commit3c522938091a074b0ad85460d56e393cd39cc2e9 (patch)
tree32247d3646e1ab310a21c46179938ca637da45fc /zebra/zebra_mpls.c
parentef148de26dbbf4dd6985ad4aa5c7d8fdec9f17cd (diff)
parent4e9a98636fe1624d5e77481701146c4a4f2bd543 (diff)
Merge pull request #10092 from ton31337/feature/replace_json_object_string_add_to_json_object_string_addf_for_inet_ntop
*: inet_ntop for JSON output
Diffstat (limited to 'zebra/zebra_mpls.c')
-rw-r--r--zebra/zebra_mpls.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 1b4fc1b75d..46f60a85c4 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -1514,7 +1514,6 @@ static int mpls_static_lsp_uninstall_all(struct zebra_vrf *zvrf,
static json_object *nhlfe_json(struct zebra_nhlfe *nhlfe)
{
- char buf[BUFSIZ];
json_object *json_nhlfe = NULL;
json_object *json_backups = NULL;
json_object *json_label_stack;
@@ -1541,15 +1540,13 @@ static json_object *nhlfe_json(struct zebra_nhlfe *nhlfe)
switch (nexthop->type) {
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
- json_object_string_add(json_nhlfe, "nexthop",
- inet_ntop(AF_INET, &nexthop->gate.ipv4,
- buf, sizeof(buf)));
+ json_object_string_addf(json_nhlfe, "nexthop", "%pI4",
+ &nexthop->gate.ipv4);
break;
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
- json_object_string_add(
- json_nhlfe, "nexthop",
- inet_ntop(AF_INET6, &nexthop->gate.ipv6, buf, BUFSIZ));
+ json_object_string_addf(json_nhlfe, "nexthop", "%pI6",
+ &nexthop->gate.ipv6);
if (nexthop->ifindex)
json_object_string_add(json_nhlfe, "interface",