pimd: fix format strings
* pim_igmp.c,
* pim_igmpv3.c,
* pim_pim.c,
* pim_tlv.c: use %zu / %zd for size_t/ssize_t
* pim_iface.c,
* pim_ifchannel.c,
* pim_mroute.c,
* pim_neighbor.c,
* pim_oil.c,
* pim_ssmpingd.c,
* pim_upstream.c: %zu for size_t
* pim_cmd.c: %zu + a few (long long) casts for int64_t
* pim_hello.c: %td for ptrdiff_t
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 60e5a16..c37e961 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -1091,8 +1091,8 @@
"RPF Cache Refresh Last: %s%s",
qpim_rpf_cache_refresh_delay_msec, VTY_NEWLINE,
pim_time_timer_remain_msec(qpim_rpf_cache_refresher), VTY_NEWLINE,
- qpim_rpf_cache_refresh_requests, VTY_NEWLINE,
- qpim_rpf_cache_refresh_events, VTY_NEWLINE,
+ (long long)qpim_rpf_cache_refresh_requests, VTY_NEWLINE,
+ (long long)qpim_rpf_cache_refresh_events, VTY_NEWLINE,
refresh_uptime, VTY_NEWLINE);
}
@@ -2241,7 +2241,7 @@
bind_addr_str,
ntohs(bind_addr.sin_port),
ss_uptime,
- ss->requests,
+ (long long)ss->requests,
VTY_NEWLINE);
}
}
@@ -3642,7 +3642,7 @@
left = sizeof(buf) - ip_hlen - pim_msg_size;
if (left < 1) {
- vty_out(vty, "%% Overflow buf_size=%d buf_left=%d at hex array arg %d=%s octet %02x%s",
+ vty_out(vty, "%% Overflow buf_size=%zu buf_left=%d at hex array arg %d=%s octet %02x%s",
sizeof(buf), left, argi, str, octet, VTY_NEWLINE);
return CMD_WARNING;
}
@@ -3653,7 +3653,7 @@
ip_msg_len = ip_hlen + pim_msg_size;
- vty_out(vty, "Receiving: buf_size=%d ip_msg_size=%d pim_msg_size=%d%s",
+ vty_out(vty, "Receiving: buf_size=%zu ip_msg_size=%d pim_msg_size=%d%s",
sizeof(buf), ip_msg_len, pim_msg_size, VTY_NEWLINE);
/* "receive" message */
@@ -3873,7 +3873,7 @@
remain = buf_pastend - buf;
if (remain < (int) sizeof(struct ip)) {
- vty_out(vty, "No room for ip header: buf_size=%d < ip_header_size=%d%s",
+ vty_out(vty, "No room for ip header: buf_size=%d < ip_header_size=%zu%s",
remain, sizeof(struct ip), VTY_NEWLINE);
return CMD_WARNING;
}
@@ -4195,7 +4195,7 @@
result = pim_mroute_msg(-1, (char *) &msg, sizeof(msg));
if (result) {
- vty_out(vty, "pim_mroute_msg(len=%d) returned failure: %d%s",
+ vty_out(vty, "pim_mroute_msg(len=%zu) returned failure: %d%s",
sizeof(msg), result, VTY_NEWLINE);
return CMD_WARNING;
}
diff --git a/pimd/pim_hello.c b/pimd/pim_hello.c
index 545b3b1..c942de4 100644
--- a/pimd/pim_hello.c
+++ b/pimd/pim_hello.c
@@ -197,7 +197,7 @@
if ((tlv_curr + option_len) > tlv_pastend) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: long PIM hello TLV type=%d length=%d > left=%d from %s on interface %s",
+ zlog_warn("%s: long PIM hello TLV type=%d length=%d > left=%td from %s on interface %s",
__PRETTY_FUNCTION__,
option_type, option_len, tlv_pastend - tlv_curr,
src_str, ifp->name);
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 52d4f0d..f0c3266 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -80,7 +80,7 @@
pim_ifp = XMALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
if (!pim_ifp) {
- zlog_err("PIM XMALLOC(%d) failure", sizeof(*pim_ifp));
+ zlog_err("PIM XMALLOC(%zu) failure", sizeof(*pim_ifp));
return 0;
}
@@ -911,7 +911,7 @@
char source_str[100];
pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
- zlog_err("%s: XMALLOC(%d) failure for IGMP group %s source %s on interface %s",
+ zlog_err("%s: XMALLOC(%zu) failure for IGMP group %s source %s on interface %s",
__PRETTY_FUNCTION__,
sizeof(*ij), group_str, source_str, ifp->name);
close(join_fd);
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index 7f946cf..6ceef4e 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -204,7 +204,7 @@
ch = XMALLOC(MTYPE_PIM_IFCHANNEL, sizeof(*ch));
if (!ch) {
- zlog_err("%s: PIM XMALLOC(%d) failure",
+ zlog_err("%s: PIM XMALLOC(%zu) failure",
__PRETTY_FUNCTION__, sizeof(*ch));
return 0;
}
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index a0a4aa8..dcb9a9b 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -679,7 +679,7 @@
char to_str[100];
if (len < sizeof(*ip_hdr)) {
- zlog_warn("IGMP packet size=%d shorter than minimum=%d",
+ zlog_warn("IGMP packet size=%zu shorter than minimum=%zu",
len, sizeof(*ip_hdr));
return -1;
}
@@ -692,7 +692,7 @@
ip_hlen = ip_hdr->ip_hl << 2; /* ip_hl gives length in 4-byte words */
if (PIM_DEBUG_IGMP_PACKETS) {
- zlog_debug("Recv IP packet from %s to %s on %s: size=%d ip_header_size=%d ip_proto=%d",
+ zlog_debug("Recv IP packet from %s to %s on %s: size=%zu ip_header_size=%zu ip_proto=%d",
from_str, to_str, igmp->interface->name, len, ip_hlen, ip_hdr->ip_p);
}
@@ -703,12 +703,12 @@
}
if (ip_hlen < PIM_IP_HEADER_MIN_LEN) {
- zlog_warn("IP packet header size=%d shorter than minimum=%d",
+ zlog_warn("IP packet header size=%zu shorter than minimum=%d",
ip_hlen, PIM_IP_HEADER_MIN_LEN);
return -1;
}
if (ip_hlen > PIM_IP_HEADER_MAX_LEN) {
- zlog_warn("IP packet header size=%d greater than maximum=%d",
+ zlog_warn("IP packet header size=%zu greater than maximum=%d",
ip_hlen, PIM_IP_HEADER_MAX_LEN);
return -1;
}
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index 7e76f44..f892652 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1151,7 +1151,7 @@
if (num_sources_tosend1 > query_buf1_max_sources) {
char group_str[100];
pim_inet4_dump("<group?>", group->group_addr, group_str, sizeof(group_str));
- zlog_warn("%s: group %s on %s: s_flag=1 unable to fit %d sources into buf_size=%d (max_sources=%d)",
+ zlog_warn("%s: group %s on %s: s_flag=1 unable to fit %d sources into buf_size=%zu (max_sources=%d)",
__PRETTY_FUNCTION__, group_str, igmp->interface->name,
num_sources_tosend1, sizeof(query_buf1), query_buf1_max_sources);
}
@@ -1193,7 +1193,7 @@
if (num_sources_tosend2 > query_buf2_max_sources) {
char group_str[100];
pim_inet4_dump("<group?>", group->group_addr, group_str, sizeof(group_str));
- zlog_warn("%s: group %s on %s: s_flag=0 unable to fit %d sources into buf_size=%d (max_sources=%d)",
+ zlog_warn("%s: group %s on %s: s_flag=0 unable to fit %d sources into buf_size=%zu (max_sources=%d)",
__PRETTY_FUNCTION__, group_str, igmp->interface->name,
num_sources_tosend2, sizeof(query_buf2), query_buf2_max_sources);
}
@@ -1622,7 +1622,7 @@
msg_size = IGMP_V3_SOURCES_OFFSET + (num_sources << 2);
if (msg_size > query_buf_size) {
- zlog_err("%s %s: unable to send: msg_size=%d larger than query_buf_size=%d",
+ zlog_err("%s %s: unable to send: msg_size=%zd larger than query_buf_size=%d",
__FILE__, __PRETTY_FUNCTION__,
msg_size, query_buf_size);
return;
@@ -1662,7 +1662,7 @@
char group_str[100];
pim_inet4_dump("<dst?>", dst_addr, dst_str, sizeof(dst_str));
pim_inet4_dump("<group?>", group_addr, group_str, sizeof(group_str));
- zlog_debug("%s: to %s on %s: group=%s sources=%d msg_size=%d s_flag=%x QRV=%u QQI=%u QQIC=%02x checksum=%x",
+ zlog_debug("%s: to %s on %s: group=%s sources=%d msg_size=%zd s_flag=%x QRV=%u QQI=%u QQIC=%02x checksum=%x",
__PRETTY_FUNCTION__,
dst_str, ifname, group_str, num_sources,
msg_size, s_flag, querier_robustness_variable,
@@ -1687,13 +1687,13 @@
pim_inet4_dump("<dst?>", dst_addr, dst_str, sizeof(dst_str));
pim_inet4_dump("<group?>", group_addr, group_str, sizeof(group_str));
if (sent < 0) {
- zlog_warn("%s: sendto() failure to %s on %s: group=%s msg_size=%d: errno=%d: %s",
+ zlog_warn("%s: sendto() failure to %s on %s: group=%s msg_size=%zd: errno=%d: %s",
__PRETTY_FUNCTION__,
dst_str, ifname, group_str, msg_size,
e, safe_strerror(e));
}
else {
- zlog_warn("%s: sendto() partial to %s on %s: group=%s msg_size=%d: sent=%d",
+ zlog_warn("%s: sendto() partial to %s on %s: group=%s msg_size=%zd: sent=%zd",
__PRETTY_FUNCTION__,
dst_str, ifname, group_str,
msg_size, sent);
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index c76ba52..d883736 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -201,7 +201,7 @@
int rd;
if (((int) sizeof(buf)) < msg_min_size) {
- zlog_err("%s: fd=%d: buf size=%d lower than msg_min=%d",
+ zlog_err("%s: fd=%d: buf size=%zu lower than msg_min=%d",
__PRETTY_FUNCTION__, fd, sizeof(buf), msg_min_size);
return -1;
}
diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c
index 9013b50..0df7422 100644
--- a/pimd/pim_neighbor.c
+++ b/pimd/pim_neighbor.c
@@ -292,7 +292,7 @@
neigh = XMALLOC(MTYPE_PIM_NEIGHBOR, sizeof(*neigh));
if (!neigh) {
- zlog_err("%s: PIM XMALLOC(%d) failure",
+ zlog_err("%s: PIM XMALLOC(%zu) failure",
__PRETTY_FUNCTION__, sizeof(*neigh));
return 0;
}
diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c
index 2c8b056..1aaece3 100644
--- a/pimd/pim_oil.c
+++ b/pimd/pim_oil.c
@@ -69,7 +69,7 @@
c_oil = XCALLOC(MTYPE_PIM_CHANNEL_OIL, sizeof(*c_oil));
if (!c_oil) {
- zlog_err("PIM XCALLOC(%d) failure", sizeof(*c_oil));
+ zlog_err("PIM XCALLOC(%zu) failure", sizeof(*c_oil));
return 0;
}
@@ -91,7 +91,7 @@
c_oil = channel_oil_new(group_addr, source_addr, input_vif_index);
if (!c_oil) {
- zlog_warn("PIM XCALLOC(%d) failure", sizeof(*c_oil));
+ zlog_warn("PIM XCALLOC(%zu) failure", sizeof(*c_oil));
return 0;
}
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index 9595d2d..156081c 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -132,7 +132,7 @@
}
if (len < sizeof(*ip_hdr)) {
- zlog_warn("PIM packet size=%d shorter than minimum=%d",
+ zlog_warn("PIM packet size=%zu shorter than minimum=%zu",
len, sizeof(*ip_hdr));
return -1;
}
@@ -145,7 +145,7 @@
ip_hlen = ip_hdr->ip_hl << 2; /* ip_hl gives length in 4-byte words */
if (PIM_DEBUG_PIM_PACKETS) {
- zlog_debug("Recv IP packet from %s to %s on %s: size=%d ip_header_size=%d ip_proto=%d",
+ zlog_debug("Recv IP packet from %s to %s on %s: size=%zu ip_header_size=%zu ip_proto=%d",
src_str, dst_str, ifp->name, len, ip_hlen, ip_hdr->ip_p);
}
@@ -156,12 +156,12 @@
}
if (ip_hlen < PIM_IP_HEADER_MIN_LEN) {
- zlog_warn("IP packet header size=%d shorter than minimum=%d",
+ zlog_warn("IP packet header size=%zu shorter than minimum=%d",
ip_hlen, PIM_IP_HEADER_MIN_LEN);
return -1;
}
if (ip_hlen > PIM_IP_HEADER_MAX_LEN) {
- zlog_warn("IP packet header size=%d greater than maximum=%d",
+ zlog_warn("IP packet header size=%zu greater than maximum=%d",
ip_hlen, PIM_IP_HEADER_MAX_LEN);
return -1;
}
@@ -480,7 +480,7 @@
e, safe_strerror(e));
}
else {
- zlog_warn("%s: sendto() partial to %s on %s: fd=%d msg_size=%d: sent=%d",
+ zlog_warn("%s: sendto() partial to %s on %s: fd=%d msg_size=%d: sent=%zd",
__PRETTY_FUNCTION__,
dst_str, ifname, fd,
pim_msg_size, sent);
diff --git a/pimd/pim_ssmpingd.c b/pimd/pim_ssmpingd.c
index 6422cf6..652999d 100644
--- a/pimd/pim_ssmpingd.c
+++ b/pimd/pim_ssmpingd.c
@@ -99,7 +99,7 @@
if (bind(fd, &sockaddr, sizeof(sockaddr))) {
char addr_str[100];
pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
- zlog_warn("%s: bind(fd=%d,addr=%s,port=%d,len=%d) failure: errno=%d: %s",
+ zlog_warn("%s: bind(fd=%d,addr=%s,port=%d,len=%zu) failure: errno=%d: %s",
__PRETTY_FUNCTION__,
fd, addr_str, port, sizeof(sockaddr),
errno, safe_strerror(errno));
@@ -373,7 +373,7 @@
if (!ss) {
char source_str[100];
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
- zlog_err("%s: XMALLOC(%d) failure for ssmpingd source %s",
+ zlog_err("%s: XMALLOC(%zu) failure for ssmpingd source %s",
__PRETTY_FUNCTION__,
sizeof(*ss), source_str);
close(sock_fd);
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index 16b7e93..cb6b654 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -39,7 +39,7 @@
uint16_t option_len = 2;
if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%d needed=%d",
+ zlog_warn("%s: buffer overflow: left=%zd needed=%d",
__PRETTY_FUNCTION__,
buf_pastend - buf, PIM_TLV_OPTION_SIZE(option_len));
return 0;
@@ -64,7 +64,7 @@
uint16_t option_len = 4;
if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%d needed=%d",
+ zlog_warn("%s: buffer overflow: left=%zd needed=%d",
__PRETTY_FUNCTION__,
buf_pastend - buf, PIM_TLV_OPTION_SIZE(option_len));
return 0;
@@ -90,7 +90,7 @@
uint16_t option_len = 4;
if ((buf + PIM_TLV_OPTION_SIZE(option_len)) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%d needed=%d",
+ zlog_warn("%s: buffer overflow: left=%zd needed=%d",
__PRETTY_FUNCTION__,
buf_pastend - buf, PIM_TLV_OPTION_SIZE(option_len));
return 0;
@@ -137,7 +137,7 @@
continue;
if ((curr + ucast_ipv4_encoding_len) > buf_pastend) {
- zlog_warn("%s: buffer overflow: left=%d needed=%d",
+ zlog_warn("%s: buffer overflow: left=%zd needed=%zu",
__PRETTY_FUNCTION__,
buf_pastend - curr, ucast_ipv4_encoding_len);
return 0;
@@ -155,7 +155,7 @@
}
if (PIM_DEBUG_PIM_TRACE) {
- zlog_warn("%s: number of encoded secondary unicast IPv4 addresses: %d",
+ zlog_warn("%s: number of encoded secondary unicast IPv4 addresses: %zu",
__PRETTY_FUNCTION__,
option_len / ucast_ipv4_encoding_len);
}
@@ -398,7 +398,7 @@
if ((addr + sizeof(struct in_addr)) > pastend) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: IPv4 unicast address overflow: left=%d needed=%d from %s on %s",
+ zlog_warn("%s: IPv4 unicast address overflow: left=%zd needed=%zu from %s on %s",
__PRETTY_FUNCTION__,
pastend - addr, sizeof(struct in_addr),
src_str, ifname);
@@ -471,7 +471,7 @@
if ((addr + sizeof(struct in_addr)) > pastend) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: IPv4 group address overflow: left=%d needed=%d from %s on %s",
+ zlog_warn("%s: IPv4 group address overflow: left=%zd needed=%zu from %s on %s",
__PRETTY_FUNCTION__,
pastend - addr, sizeof(struct in_addr),
src_str, ifname);
@@ -549,7 +549,7 @@
if ((addr + sizeof(struct in_addr)) > pastend) {
char src_str[100];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- zlog_warn("%s: IPv4 source address overflow: left=%d needed=%d from %s on %s",
+ zlog_warn("%s: IPv4 source address overflow: left=%zd needed=%zu from %s on %s",
__PRETTY_FUNCTION__,
pastend - addr, sizeof(struct in_addr),
src_str, ifname);
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index b9cf1e5..6702ca1 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -355,7 +355,7 @@
up = XMALLOC(MTYPE_PIM_UPSTREAM, sizeof(*up));
if (!up) {
- zlog_err("%s: PIM XMALLOC(%d) failure",
+ zlog_err("%s: PIM XMALLOC(%zu) failure",
__PRETTY_FUNCTION__, sizeof(*up));
return 0;
}