summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-11-18 09:55:47 +0100
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-11-18 10:35:29 +0100
commitc949c77101d2e862b401e9ccf3c09c7b7d024ba9 (patch)
tree5241f98e42a3fda29f1dbf5a0ab00f9c4df598c8
parenttools: Add coccinelle script to replace inet_ntop inside JSON (diff)
downloadfrr-c949c77101d2e862b401e9ccf3c09c7b7d024ba9.tar.xz
frr-c949c77101d2e862b401e9ccf3c09c7b7d024ba9.zip
bgpd: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
-rw-r--r--bgpd/bgp_evpn_mh.c15
-rw-r--r--bgpd/bgp_evpn_vty.c58
-rw-r--r--bgpd/bgp_route.c154
-rw-r--r--bgpd/bgp_vpn.c6
-rw-r--r--bgpd/bgp_vty.c42
5 files changed, 101 insertions, 174 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index 9316d218a..8bfddf2bb 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -2195,9 +2195,8 @@ static void bgp_evpn_es_json_vtep_fill(json_object *json_vteps,
json_vtep_entry = json_object_new_object();
- json_object_string_add(
- json_vtep_entry, "vtep_ip",
- inet_ntop(AF_INET, &es_vtep->vtep_ip, ip_buf, sizeof(ip_buf)));
+ json_object_string_addf(json_vtep_entry, "vtep_ip", "%pI4",
+ &es_vtep->vtep_ip);
if (es_vtep->flags & (BGP_EVPNES_VTEP_ESR |
BGP_EVPNES_VTEP_ACTIVE)) {
json_flags = json_object_new_array();
@@ -2338,9 +2337,8 @@ static void bgp_evpn_es_show_entry_detail(struct vty *vty,
json_array_string_add(json_flags, "bypass");
json_object_object_add(json, "flags", json_flags);
}
- json_object_string_add(json, "originator_ip",
- inet_ntop(AF_INET, &es->originator_ip,
- ip_buf, sizeof(ip_buf)));
+ json_object_string_addf(json, "originator_ip", "%pI4",
+ &es->originator_ip);
json_object_int_add(json, "remoteVniCount",
es->remote_es_evi_cnt);
json_object_int_add(json, "vrfCount",
@@ -3718,9 +3716,8 @@ static void bgp_evpn_es_evi_json_vtep_fill(json_object *json_vteps,
json_vtep_entry = json_object_new_object();
- json_object_string_add(
- json_vtep_entry, "vtep_ip",
- inet_ntop(AF_INET, &evi_vtep->vtep_ip, ip_buf, sizeof(ip_buf)));
+ json_object_string_addf(json_vtep_entry, "vtep_ip", "%pI4",
+ &evi_vtep->vtep_ip);
if (evi_vtep->flags & (BGP_EVPN_EVI_VTEP_EAD_PER_ES |
BGP_EVPN_EVI_VTEP_EAD_PER_EVI)) {
json_flags = json_object_new_array();
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index aced0177e..e3dccf86f 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -390,19 +390,15 @@ static void display_l3vni(struct vty *vty, struct bgp *bgp_vrf,
json_object_string_add(
json, "rd",
prefix_rd2str(&bgp_vrf->vrf_prd, buf1, RD_ADDRSTRLEN));
- json_object_string_add(
- json, "originatorIp",
- inet_ntop(AF_INET, &bgp_vrf->originator_ip,
- originator_ip, sizeof(originator_ip)));
+ json_object_string_addf(json, "originatorIp", "%pI4",
+ &bgp_vrf->originator_ip);
json_object_string_add(json, "advertiseGatewayMacip", "n/a");
json_object_string_add(json, "advertiseSviMacIp", "n/a");
json_object_string_add(json, "advertisePip",
bgp_vrf->evpn_info->advertise_pip ?
"Enabled" : "Disabled");
- json_object_string_add(json, "sysIP",
- inet_ntop(AF_INET,
- &bgp_vrf->evpn_info->pip_ip,
- buf1, INET_ADDRSTRLEN));
+ json_object_string_addf(json, "sysIP", "%pI4",
+ &bgp_vrf->evpn_info->pip_ip);
json_object_string_add(json, "sysMac",
prefix_mac2str(&bgp_vrf->evpn_info->pip_rmac,
buf2, sizeof(buf2)));
@@ -497,12 +493,10 @@ static void display_vni(struct vty *vty, struct bgpevpn *vpn, json_object *json)
json_object_string_add(
json, "rd",
prefix_rd2str(&vpn->prd, buf1, sizeof(buf1)));
- json_object_string_add(json, "originatorIp",
- inet_ntop(AF_INET, &vpn->originator_ip,
- buf, sizeof(buf)));
- json_object_string_add(
- json, "mcastGroup",
- inet_ntop(AF_INET, &vpn->mcast_grp, buf, sizeof(buf)));
+ json_object_string_addf(json, "originatorIp", "%pI4",
+ &vpn->originator_ip);
+ json_object_string_addf(json, "mcastGroup", "%pI4",
+ &vpn->mcast_grp);
/* per vni knob is enabled -- Enabled
* Global knob is enabled -- Active
* default -- Disabled
@@ -956,9 +950,8 @@ static void show_l3vni_entry(struct vty *vty, struct bgp *bgp,
json_object_int_add(json_vni, "vni", bgp->l3vni);
json_object_string_add(json_vni, "type", "L3");
json_object_string_add(json_vni, "inKernel", "True");
- json_object_string_add(json_vni, "originatorIp",
- inet_ntop(AF_INET, &bgp->originator_ip,
- buf3, sizeof(buf3)));
+ json_object_string_addf(json_vni, "originatorIp", "%pI4",
+ &bgp->originator_ip);
json_object_string_add(
json_vni, "rd",
prefix_rd2str(&bgp->vrf_prd, buf2, RD_ADDRSTRLEN));
@@ -968,10 +961,8 @@ static void show_l3vni_entry(struct vty *vty, struct bgp *bgp,
json_object_string_add(
json_vni, "advertisePip",
bgp->evpn_info->advertise_pip ? "Enabled" : "Disabled");
- json_object_string_add(json_vni, "sysIP",
- inet_ntop(AF_INET,
- &bgp->evpn_info->pip_ip, buf3,
- sizeof(buf3)));
+ json_object_string_addf(json_vni, "sysIP", "%pI4",
+ &bgp->evpn_info->pip_ip);
json_object_string_add(json_vni, "sysMAC",
prefix_mac2str(&bgp->evpn_info->pip_rmac,
buf2, sizeof(buf2)));
@@ -1090,12 +1081,10 @@ static void show_vni_entry(struct hash_bucket *bucket, void *args[])
json_object_string_add(
json_vni, "rd",
prefix_rd2str(&vpn->prd, buf2, sizeof(buf2)));
- json_object_string_add(json_vni, "originatorIp",
- inet_ntop(AF_INET, &vpn->originator_ip,
- buf3, sizeof(buf3)));
- json_object_string_add(json_vni, "mcastGroup",
- inet_ntop(AF_INET, &vpn->mcast_grp, buf3,
- sizeof(buf3)));
+ json_object_string_addf(json_vni, "originatorIp", "%pI4",
+ &vpn->originator_ip);
+ json_object_string_addf(json_vni, "mcastGroup", "%pI4",
+ &vpn->mcast_grp);
/* per vni knob is enabled -- Enabled
* Global knob is enabled -- Active
* default -- Disabled
@@ -1296,14 +1285,11 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
json_object_int_add(
json, "bgpTableVersion",
tbl_ver);
- json_object_string_add(
+ json_object_string_addf(
json,
"bgpLocalRouterId",
- inet_ntop(
- AF_INET,
- &bgp->router_id,
- router_id,
- sizeof(router_id)));
+ "%pI4",
+ &bgp->router_id);
json_object_int_add(
json,
"defaultLocPrf",
@@ -5845,10 +5831,8 @@ DEFUN (show_bgp_vrf_l3vni_info,
prefix_rd2str(&bgp->vrf_prd, buf1, RD_ADDRSTRLEN));
} else {
json_object_string_add(json, "vrf", name);
- json_object_string_add(json, "local-ip",
- inet_ntop(AF_INET, &bgp->originator_ip,
- originator_ip,
- sizeof(originator_ip)));
+ json_object_string_addf(json, "local-ip", "%pI4",
+ &bgp->originator_ip);
json_object_int_add(json, "l3vni", bgp->l3vni);
json_object_string_add(
json, "rmac",
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index e51bf5569..3bc267e3a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -8737,10 +8737,8 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
json_nexthop_global = json_object_new_object();
- json_object_string_add(json_nexthop_global, "ip",
- inet_ntop(AF_INET,
- &attr->nexthop, buf,
- sizeof(buf)));
+ json_object_string_addf(json_nexthop_global, "ip",
+ "%pI4", &attr->nexthop);
if (path->peer->hostname)
json_object_string_add(json_nexthop_global,
@@ -8774,10 +8772,9 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
json_object_string_add(json_nexthop_global,
"afi", "ipv4");
- json_object_string_add(
- json_nexthop_global, "ip",
- inet_ntop(AF_INET, &attr->nexthop, buf,
- sizeof(buf)));
+ json_object_string_addf(json_nexthop_global,
+ "ip", "%pI4",
+ &attr->nexthop);
if (path->peer->hostname)
json_object_string_add(
@@ -8811,10 +8808,8 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
json_nexthop_global = json_object_new_object();
- json_object_string_add(json_nexthop_global, "ip",
- inet_ntop(AF_INET,
- &attr->nexthop, buf,
- sizeof(buf)));
+ json_object_string_addf(json_nexthop_global, "ip",
+ "%pI4", &attr->nexthop);
if (path->peer->hostname)
json_object_string_add(json_nexthop_global,
@@ -8847,10 +8842,9 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
if (json_paths) {
json_nexthop_global = json_object_new_object();
- json_object_string_add(
- json_nexthop_global, "ip",
- inet_ntop(AF_INET6, &attr->mp_nexthop_global,
- buf, BUFSIZ));
+ json_object_string_addf(json_nexthop_global, "ip",
+ "%pI6",
+ &attr->mp_nexthop_global);
if (path->peer->hostname)
json_object_string_add(json_nexthop_global,
@@ -8868,11 +8862,9 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL)
|| (path->peer->conf_if)) {
json_nexthop_ll = json_object_new_object();
- json_object_string_add(
- json_nexthop_ll, "ip",
- inet_ntop(AF_INET6,
- &attr->mp_nexthop_local, buf,
- BUFSIZ));
+ json_object_string_addf(
+ json_nexthop_ll, "ip", "%pI6",
+ &attr->mp_nexthop_local);
if (path->peer->hostname)
json_object_string_add(
@@ -9131,36 +9123,27 @@ void route_vty_out_tmp(struct vty *vty, struct bgp_dest *dest,
&& (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| !BGP_ATTR_NEXTHOP_AFI_IP6(attr))) {
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP)
- json_object_string_add(
- json_net, "nextHop",
- inet_ntop(
- AF_INET,
- &attr->mp_nexthop_global_in,
- buf, sizeof(buf)));
+ json_object_string_addf(
+ json_net, "nextHop", "%pI4",
+ &attr->mp_nexthop_global_in);
else
- json_object_string_add(
- json_net, "nextHop",
- inet_ntop(AF_INET,
- &attr->nexthop, buf,
- sizeof(buf)));
+ json_object_string_addf(
+ json_net, "nextHop", "%pI4",
+ &attr->nexthop);
} else if (p->family == AF_INET6
|| BGP_ATTR_NEXTHOP_AFI_IP6(attr)) {
char buf[BUFSIZ];
- json_object_string_add(
- json_net, "nextHopGlobal",
- inet_ntop(AF_INET6,
- &attr->mp_nexthop_global, buf,
- BUFSIZ));
+ json_object_string_addf(
+ json_net, "nextHopGlobal", "%pI6",
+ &attr->mp_nexthop_global);
} else if (p->family == AF_EVPN
&& !BGP_ATTR_NEXTHOP_AFI_IP6(attr)) {
char buf[BUFSIZ] = {0};
- json_object_string_add(
- json_net, "nextHop",
- inet_ntop(AF_INET,
- &attr->mp_nexthop_global_in,
- buf, sizeof(buf)));
+ json_object_string_addf(
+ json_net, "nextHop", "%pI4",
+ &attr->mp_nexthop_global_in);
}
if (attr->flag
@@ -9284,20 +9267,16 @@ void route_vty_out_tag(struct vty *vty, const struct prefix *p,
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| safi == SAFI_EVPN) {
if (json)
- json_object_string_add(
- json_out, "mpNexthopGlobalIn",
- inet_ntop(AF_INET,
- &attr->mp_nexthop_global_in,
- buf, sizeof(buf)));
+ json_object_string_addf(
+ json_out, "mpNexthopGlobalIn", "%pI4",
+ &attr->mp_nexthop_global_in);
else
vty_out(vty, "%-16pI4",
&attr->mp_nexthop_global_in);
} else {
if (json)
- json_object_string_add(
- json_out, "nexthop",
- inet_ntop(AF_INET, &attr->nexthop, buf,
- sizeof(buf)));
+ json_object_string_addf(json_out, "nexthop",
+ "%pI4", &attr->nexthop);
else
vty_out(vty, "%-16pI4", &attr->nexthop);
}
@@ -9309,11 +9288,9 @@ void route_vty_out_tag(struct vty *vty, const struct prefix *p,
if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) {
if (json)
- json_object_string_add(
- json_out, "mpNexthopGlobalIn",
- inet_ntop(AF_INET6,
- &attr->mp_nexthop_global,
- buf_a, sizeof(buf_a)));
+ json_object_string_addf(
+ json_out, "mpNexthopGlobalIn", "%pI6",
+ &attr->mp_nexthop_global);
else
vty_out(vty, "%s",
inet_ntop(AF_INET6,
@@ -9891,10 +9868,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
json_object_int_add(json_path, "aggregatorAs",
attr->aggregator_as);
- json_object_string_add(json_path, "aggregatorId",
- inet_ntop(AF_INET,
- &attr->aggregator_addr,
- buf, sizeof(buf)));
+ json_object_string_addf(json_path, "aggregatorId",
+ "%pI4", &attr->aggregator_addr);
} else {
vty_out(vty, ", (aggregated by %u %pI4)",
attr->aggregator_as, &attr->aggregator_addr);
@@ -9949,11 +9924,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
if (safi == SAFI_MPLS_VPN || safi == SAFI_ENCAP
|| safi == SAFI_EVPN) {
if (json_paths) {
- json_object_string_add(
- json_nexthop_global, "ip",
- inet_ntop(AF_INET,
- &attr->mp_nexthop_global_in,
- buf, sizeof(buf)));
+ json_object_string_addf(
+ json_nexthop_global, "ip", "%pI4",
+ &attr->mp_nexthop_global_in);
if (path->peer->hostname)
json_object_string_add(
@@ -9970,10 +9943,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
}
} else {
if (json_paths) {
- json_object_string_add(
- json_nexthop_global, "ip",
- inet_ntop(AF_INET, &attr->nexthop, buf,
- sizeof(buf)));
+ json_object_string_addf(json_nexthop_global,
+ "ip", "%pI4",
+ &attr->nexthop);
if (path->peer->hostname)
json_object_string_add(
@@ -9995,10 +9967,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
"ipv4");
} else {
if (json_paths) {
- json_object_string_add(
- json_nexthop_global, "ip",
- inet_ntop(AF_INET6, &attr->mp_nexthop_global,
- buf, INET6_ADDRSTRLEN));
+ json_object_string_addf(json_nexthop_global, "ip",
+ "%pI6",
+ &attr->mp_nexthop_global);
if (path->peer->hostname)
json_object_string_add(json_nexthop_global,
@@ -10073,10 +10044,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
if (json_paths) {
char buf[BUFSIZ] = {0};
- json_object_string_add(json_peer, "routerId",
- inet_ntop(AF_INET,
- &bgp->router_id, buf,
- sizeof(buf)));
+ json_object_string_addf(json_peer, "routerId", "%pI4",
+ &bgp->router_id);
} else {
vty_out(vty, "(%pI4)", &bgp->router_id);
}
@@ -10090,10 +10059,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
sockunion2str(&path->peer->su,
buf,
SU_ADDRSTRLEN));
- json_object_string_add(json_peer, "routerId",
- inet_ntop(AF_INET,
- &path->peer->remote_id,
- buf1, sizeof(buf1)));
+ json_object_string_addf(json_peer, "routerId", "%pI4",
+ &path->peer->remote_id);
if (path->peer->hostname)
json_object_string_add(json_peer, "hostname",
@@ -10193,10 +10160,8 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
if (json_paths) {
json_nexthop_ll = json_object_new_object();
- json_object_string_add(
- json_nexthop_ll, "ip",
- inet_ntop(AF_INET6, &attr->mp_nexthop_local,
- buf, INET6_ADDRSTRLEN));
+ json_object_string_addf(json_nexthop_ll, "ip", "%pI6",
+ &attr->mp_nexthop_local);
if (path->peer->hostname)
json_object_string_add(json_nexthop_ll,
@@ -10459,10 +10424,9 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) {
if (json_paths)
- json_object_string_add(
- json_path, "originatorId",
- inet_ntop(AF_INET, &attr->originator_id,
- buf, sizeof(buf)));
+ json_object_string_addf(json_path,
+ "originatorId", "%pI4",
+ &attr->originator_id);
else
vty_out(vty, " Originator: %pI4",
&attr->originator_id);
@@ -13440,10 +13404,8 @@ static void show_adj_route_header(struct vty *vty, struct bgp *bgp,
if (*header1) {
if (json) {
json_object_int_add(json, "bgpTableVersion", version);
- json_object_string_add(json, "bgpLocalRouterId",
- inet_ntop(AF_INET,
- &bgp->router_id, buf,
- sizeof(buf)));
+ json_object_string_addf(json, "bgpLocalRouterId",
+ "%pI4", &bgp->router_id);
json_object_int_add(json, "defaultLocPrf",
bgp->default_local_pref);
json_object_int_add(json, "localAS", bgp->as);
@@ -13514,10 +13476,8 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
if (use_json) {
json_object_int_add(json, "bgpTableVersion",
table->version);
- json_object_string_add(json, "bgpLocalRouterId",
- inet_ntop(AF_INET,
- &bgp->router_id, buf,
- sizeof(buf)));
+ json_object_string_addf(json, "bgpLocalRouterId",
+ "%pI4", &bgp->router_id);
json_object_int_add(json, "defaultLocPrf",
bgp->default_local_pref);
json_object_int_add(json, "localAS", bgp->as);
diff --git a/bgpd/bgp_vpn.c b/bgpd/bgp_vpn.c
index 8d2cffbb4..0225cf90e 100644
--- a/bgpd/bgp_vpn.c
+++ b/bgpd/bgp_vpn.c
@@ -122,11 +122,9 @@ int show_adj_route_vpn(struct vty *vty, struct peer *peer,
json_object_int_add(
json, "bgpTableVersion", 0);
- json_object_string_add(
+ json_object_string_addf(
json, "bgpLocalRouterId",
- inet_ntop(AF_INET,
- &bgp->router_id, buf,
- sizeof(buf)));
+ "%pI4", &bgp->router_id);
json_object_int_add(
json,
"defaultLocPrf",
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 3725f242e..97b54c64c 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -9690,10 +9690,8 @@ DEFUN (show_bgp_vrfs,
json_object_string_add(json_vrf, "type", type);
json_object_int_add(json_vrf, "vrfId", vrf_id_ui);
- json_object_string_add(json_vrf, "routerId",
- inet_ntop(AF_INET,
- &bgp->router_id, buf,
- sizeof(buf)));
+ json_object_string_addf(json_vrf, "routerId", "%pI4",
+ &bgp->router_id);
json_object_int_add(json_vrf, "numConfiguredPeers",
peers_cfg);
json_object_int_add(json_vrf, "numEstablishedPeers",
@@ -10292,10 +10290,9 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
if (use_json) {
char buf[BUFSIZ] = {0};
- json_object_string_add(
- json, "routerId",
- inet_ntop(AF_INET, &bgp->router_id, buf,
- sizeof(buf)));
+ json_object_string_addf(json, "routerId",
+ "%pI4",
+ &bgp->router_id);
json_object_int_add(json, "as", bgp->as);
json_object_int_add(json, "vrfId", vrf_id_ui);
json_object_string_add(
@@ -12404,13 +12401,10 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
/* BGP Version. */
json_object_int_add(json_neigh, "bgpVersion", 4);
- json_object_string_add(
- json_neigh, "remoteRouterId",
- inet_ntop(AF_INET, &p->remote_id, buf1, sizeof(buf1)));
- json_object_string_add(
- json_neigh, "localRouterId",
- inet_ntop(AF_INET, &bgp->router_id, buf1,
- sizeof(buf1)));
+ json_object_string_addf(json_neigh, "remoteRouterId", "%pI4",
+ &p->remote_id);
+ json_object_string_addf(json_neigh, "localRouterId", "%pI4",
+ &bgp->router_id);
/* Confederation */
if (CHECK_FLAG(bgp->config, BGP_CONFIG_CONFEDERATION)
@@ -13999,18 +13993,12 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
/* Nexthop display. */
if (p->su_local) {
if (use_json) {
- json_object_string_add(json_neigh, "nexthop",
- inet_ntop(AF_INET,
- &p->nexthop.v4, buf1,
- sizeof(buf1)));
- json_object_string_add(json_neigh, "nexthopGlobal",
- inet_ntop(AF_INET6,
- &p->nexthop.v6_global,
- buf1, sizeof(buf1)));
- json_object_string_add(json_neigh, "nexthopLocal",
- inet_ntop(AF_INET6,
- &p->nexthop.v6_local,
- buf1, sizeof(buf1)));
+ json_object_string_addf(json_neigh, "nexthop", "%pI4",
+ &p->nexthop.v4);
+ json_object_string_addf(json_neigh, "nexthopGlobal",
+ "%pI6", &p->nexthop.v6_global);
+ json_object_string_addf(json_neigh, "nexthopLocal",
+ "%pI6", &p->nexthop.v6_local);
if (p->shared_network)
json_object_string_add(json_neigh,
"bgpConnection",