summaryrefslogtreecommitdiffstats
path: root/pimd/pim_igmp_mtrace.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-03-10 16:16:42 +0100
committerDavid Lamparter <equinox@diac24.net>2021-03-14 22:56:07 +0100
commit6b73800ba27e7f69453a191dfb873c2e07194516 (patch)
treed2928347f91b3e6b9e21a7ad1e75bac630dd5650 /pimd/pim_igmp_mtrace.c
parentbabeld: We do not need to put Warning into our warning messages (diff)
downloadfrr-6b73800ba27e7f69453a191dfb873c2e07194516.tar.xz
frr-6b73800ba27e7f69453a191dfb873c2e07194516.zip
pimd: Use builtin printf functionality
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'pimd/pim_igmp_mtrace.c')
-rw-r--r--pimd/pim_igmp_mtrace.c75
1 files changed, 17 insertions, 58 deletions
diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c
index 941d06761..a562f3ce9 100644
--- a/pimd/pim_igmp_mtrace.c
+++ b/pimd/pim_igmp_mtrace.c
@@ -66,7 +66,6 @@ static bool mtrace_fwd_info_weak(struct pim_instance *pim,
struct pim_nexthop nexthop;
struct interface *ifp_in;
struct in_addr nh_addr;
- char nexthop_str[INET_ADDRSTRLEN];
nh_addr.s_addr = INADDR_ANY;
@@ -82,10 +81,8 @@ static bool mtrace_fwd_info_weak(struct pim_instance *pim,
zlog_debug("mtrace pim_nexthop_lookup OK");
if (PIM_DEBUG_MTRACE)
- zlog_debug("mtrace next_hop=%s",
- inet_ntop(nexthop.mrib_nexthop_addr.family,
- &nexthop.mrib_nexthop_addr.u.prefix,
- nexthop_str, sizeof(nexthop_str)));
+ zlog_debug("mtrace next_hop=%pI4",
+ &nexthop.mrib_nexthop_addr.u.prefix);
if (nexthop.mrib_nexthop_addr.family == AF_INET)
nh_addr = nexthop.mrib_nexthop_addr.u.prefix4;
@@ -114,7 +111,6 @@ static bool mtrace_fwd_info(struct pim_instance *pim,
struct interface *ifp_in;
struct in_addr nh_addr;
uint32_t total;
- char up_str[INET_ADDRSTRLEN];
memset(&sg, 0, sizeof(struct prefix_sg));
sg.src = mtracep->src_addr;
@@ -142,9 +138,7 @@ static bool mtrace_fwd_info(struct pim_instance *pim,
total = htonl(MTRACE_UNKNOWN_COUNT);
if (PIM_DEBUG_MTRACE)
- zlog_debug("fwd_info: upstream next hop=%s",
- inet_ntop(AF_INET, &(nh_addr), up_str,
- sizeof(up_str)));
+ zlog_debug("fwd_info: upstream next hop=%pI4", &nh_addr);
if (up->channel_oil)
total = up->channel_oil->cc.pktcnt;
@@ -198,31 +192,16 @@ static void mtrace_rsp_init(struct igmp_mtrace_rsp *mtrace_rspp)
static void mtrace_rsp_debug(uint32_t qry_id, int rsp,
struct igmp_mtrace_rsp *mrspp)
{
- char inc_str[INET_ADDRSTRLEN];
- char out_str[INET_ADDRSTRLEN];
- char prv_str[INET_ADDRSTRLEN];
-
zlog_debug(
- "Rx mt(%d) qid=%ud arr=%x in=%s out=%s prev=%s proto=%d fwd=%d",
- rsp, ntohl(qry_id), mrspp->arrival,
- inet_ntop(AF_INET, &(mrspp->incoming), inc_str,
- sizeof(inc_str)),
- inet_ntop(AF_INET, &(mrspp->outgoing), out_str,
- sizeof(out_str)),
- inet_ntop(AF_INET, &(mrspp->prev_hop), prv_str,
- sizeof(prv_str)),
- mrspp->rtg_proto, mrspp->fwd_code);
+ "Rx mt(%d) qid=%ud arr=%x in=%pI4 out=%pI4 prev=%pI4 proto=%d fwd=%d",
+ rsp, ntohl(qry_id), mrspp->arrival, &mrspp->incoming,
+ &mrspp->outgoing, &mrspp->prev_hop, mrspp->rtg_proto,
+ mrspp->fwd_code);
}
static void mtrace_debug(struct pim_interface *pim_ifp,
struct igmp_mtrace *mtracep, int mtrace_len)
{
- char inc_str[INET_ADDRSTRLEN];
- char grp_str[INET_ADDRSTRLEN];
- char src_str[INET_ADDRSTRLEN];
- char dst_str[INET_ADDRSTRLEN];
- char rsp_str[INET_ADDRSTRLEN];
-
struct in_addr ga, sa, da, ra;
ga = mtracep->grp_addr;
@@ -231,19 +210,10 @@ static void mtrace_debug(struct pim_interface *pim_ifp,
ra = mtracep->rsp_addr;
zlog_debug(
- "Rx mtrace packet incoming on %s: hops=%d type=%d size=%d, grp=%s, src=%s, dst=%s rsp=%s ttl=%d qid=%ud",
- inet_ntop(AF_INET, &(pim_ifp->primary_address), inc_str,
- sizeof(inc_str)),
- mtracep->hops, mtracep->type, mtrace_len,
- inet_ntop(AF_INET, &ga, grp_str,
- sizeof(grp_str)),
- inet_ntop(AF_INET, &sa, src_str,
- sizeof(src_str)),
- inet_ntop(AF_INET, &da, dst_str,
- sizeof(dst_str)),
- inet_ntop(AF_INET, &ra, rsp_str,
- sizeof(rsp_str)),
- mtracep->rsp_ttl, ntohl(mtracep->qry_id));
+ "Rx mtrace packet incoming on %pI4: hops=%d type=%d size=%d, grp=%pI4, src=%pI4, dst=%pI4 rsp=%pI4 ttl=%d qid=%ud",
+ &pim_ifp->primary_address, mtracep->hops, mtracep->type,
+ mtrace_len, &ga, &sa, &da, &ra, mtracep->rsp_ttl,
+ ntohl(mtracep->qry_id));
if (mtrace_len > (int)sizeof(struct igmp_mtrace)) {
int i;
@@ -290,8 +260,6 @@ static int mtrace_send_packet(struct interface *ifp,
ssize_t sent;
int ret;
int fd;
- char if_str[INET_ADDRSTRLEN];
- char rsp_str[INET_ADDRSTRLEN];
uint8_t ttl;
memset(&to, 0, sizeof(to));
@@ -303,11 +271,8 @@ static int mtrace_send_packet(struct interface *ifp,
struct in_addr if_addr;
if_addr = mtrace_primary_address(ifp);
- zlog_debug(
- "Sending mtrace packet to %s on %s",
- inet_ntop(AF_INET, &mtracep->rsp_addr, rsp_str,
- sizeof(rsp_str)),
- inet_ntop(AF_INET, &if_addr, if_str, sizeof(if_str)));
+ zlog_debug("Sending mtrace packet to %pI4 on %pI4",
+ &mtracep->rsp_addr, &if_addr);
}
fd = pim_socket_raw(IPPROTO_IGMP);
@@ -514,7 +479,6 @@ static int mtrace_send_mc_response(struct pim_instance *pim,
struct listnode *chnextnode;
struct pim_ifchannel *ch = NULL;
int ret = -1;
- char buf[PREFIX_STRLEN];
memset(&sg, 0, sizeof(struct prefix_sg));
sg.grp = mtracep->rsp_addr;
@@ -524,10 +488,8 @@ static int mtrace_send_mc_response(struct pim_instance *pim,
if (c_oil == NULL) {
if (PIM_DEBUG_MTRACE) {
zlog_debug(
- "Dropping mtrace multicast response packet len=%u to %s",
- (unsigned int)mtrace_len,
- inet_ntop(AF_INET, &mtracep->rsp_addr,
- buf, sizeof(buf)));
+ "Dropping mtrace multicast response packet len=%u to %pI4",
+ (unsigned int)mtrace_len, &mtracep->rsp_addr);
}
return -1;
}
@@ -562,7 +524,6 @@ static int mtrace_send_response(struct pim_instance *pim,
if (IPV4_CLASS_DE(ntohl(mtracep->rsp_addr.s_addr))) {
struct pim_rpf *p_rpf;
- char grp_str[INET_ADDRSTRLEN];
if (pim_rp_i_am_rp(pim, mtracep->rsp_addr))
return mtrace_send_mc_response(pim, mtracep,
@@ -572,10 +533,8 @@ static int mtrace_send_response(struct pim_instance *pim,
if (p_rpf == NULL) {
if (PIM_DEBUG_MTRACE)
- zlog_debug("mtrace no RP for %s",
- inet_ntop(AF_INET,
- &(mtracep->rsp_addr),
- grp_str, sizeof(grp_str)));
+ zlog_debug("mtrace no RP for %pI4",
+ &mtracep->rsp_addr);
return -1;
}
nexthop = p_rpf->source_nexthop;