summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-11-18 09:58:09 +0100
committerDonatas Abraitis <donatas.abraitis@gmail.com>2021-11-18 17:45:41 +0100
commitb0d5264e3ff279414b7adb22f5e0ddf70d2c5773 (patch)
treec25fed81af1b85eb195a3b98d9e6324a5960f293 /pimd/pim_cmd.c
parentospf6d: Replace inet_ntop to %pI4/6 for JSON outputs (diff)
downloadfrr-b0d5264e3ff279414b7adb22f5e0ddf70d2c5773.tar.xz
frr-b0d5264e3ff279414b7adb22f5e0ddf70d2c5773.zip
pimd: Replace inet_ntop to %pI4/6 for JSON outputs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 82627e5e8..0372985ea 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -313,9 +313,8 @@ static void json_object_pim_ifp_add(struct json_object *json,
pim_ifp = ifp->info;
json_object_string_add(json, "name", ifp->name);
json_object_string_add(json, "state", if_is_up(ifp) ? "up" : "down");
- json_object_string_add(json, "address",
- inet_ntop(AF_INET, &pim_ifp->primary_address,
- buf, sizeof(buf)));
+ json_object_string_addf(json, "address", "%pI4",
+ &pim_ifp->primary_address);
json_object_int_add(json, "index", ifp->ifindex);
if (if_is_multicast(ifp))
@@ -537,10 +536,9 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
"queryTimer",
query_hhmmss);
}
- json_object_string_add(
- json_row, "querierIp",
- inet_ntop(AF_INET, &igmp->querier_addr,
- quer_buf, sizeof(quer_buf)));
+ json_object_string_addf(json_row, "querierIp",
+ "%pI4",
+ &igmp->querier_addr);
json_object_object_add(json, ifp->name,
json_row);
@@ -669,10 +667,9 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
igmp->t_igmp_query_timer
? "local"
: "other");
- json_object_string_add(
- json_row, "querierIp",
- inet_ntop(AF_INET, &igmp->querier_addr,
- quer_buf, sizeof(quer_buf)));
+ json_object_string_addf(json_row, "querierIp",
+ "%pI4",
+ &igmp->querier_addr);
json_object_int_add(json_row, "queryStartCount",
igmp->startup_query_count);
json_object_string_add(json_row,
@@ -979,11 +976,9 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
json_object_pim_ifp_add(json_row, ifp);
if (pim_ifp->update_source.s_addr != INADDR_ANY) {
- json_object_string_add(
- json_row, "useSource",
- inet_ntop(AF_INET,
- &pim_ifp->update_source,
- buf, sizeof(buf)));
+ json_object_string_addf(
+ json_row, "useSource", "%pI4",
+ &pim_ifp->update_source);
}
if (pim_ifp->sec_addr_list) {
json_object *sec_list = NULL;
@@ -1437,10 +1432,8 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
json_object_int_add(json_row, "pimNeighbors", pim_nbrs);
json_object_int_add(json_row, "pimIfChannels", pim_ifchannels);
json_object_int_add(json_row, "firstHopRouterCount", fhr);
- json_object_string_add(json_row, "pimDesignatedRouter",
- inet_ntop(AF_INET,
- &pim_ifp->pim_dr_addr, buf,
- sizeof(buf)));
+ json_object_string_addf(json_row, "pimDesignatedRouter", "%pI4",
+ &pim_ifp->pim_dr_addr);
if (pim_ifp->pim_dr_addr.s_addr
== pim_ifp->primary_address.s_addr)
@@ -5715,10 +5708,8 @@ static void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty,
json_object_string_add(json_row, "name", ifp->name);
json_object_string_add(json_row, "state",
if_is_up(ifp) ? "up" : "down");
- json_object_string_add(
- json_row, "address",
- inet_ntop(AF_INET, &pim_ifp->primary_address,
- buf, sizeof(buf)));
+ json_object_string_addf(json_row, "address", "%pI4",
+ &pim_ifp->primary_address);
json_object_int_add(json_row, "ifIndex", ifp->ifindex);
json_object_int_add(json_row, "vif",
pim_ifp->mroute_vif_index);