From 8787b71e03cbd4e1d3784493cc2ef701b1077b81 Mon Sep 17 00:00:00 2001 From: jcaiMR <111116206+jcaiMR@users.noreply.github.com> Date: Wed, 6 Sep 2023 00:42:56 +0800 Subject: [PATCH] fix counter log issue on 32bits platform (#16357) Cherry pick sonic-net/sonic-dhcpmon#11 into 202205. --- src/dhcpmon/src/dhcp_device.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/dhcpmon/src/dhcp_device.cpp b/src/dhcpmon/src/dhcp_device.cpp index 12c0e1544903..ac46ef6d1351 100644 --- a/src/dhcpmon/src/dhcp_device.cpp +++ b/src/dhcpmon/src/dhcp_device.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -303,9 +304,6 @@ static void client_packet_handler(dhcp_device_context_t *context, uint8_t *buffe offset += dhcp_option[offset + 1] + 2; } } - } else { - syslog(LOG_WARNING, "read_callback(%s %s): read length (%ld) is too small to capture DHCP options", - context->intf, dir == DHCP_TX ? "TX" : "RX", buffer_sz); } } @@ -560,7 +558,8 @@ static void dhcp_print_counters(const char *vlan_intf, syslog( LOG_NOTICE, - "[%*s-%*s rx/tx] Discover: %*lu/%*lu, Offer: %*lu/%*lu, Request: %*lu/%*lu, ACK: %*lu/%*lu\n", + "[%*s-%*s rx/tx] Discover: %*" PRIu64 "/%*" PRIu64 ", Offer: %*" PRIu64 "/%*" PRIu64 + ", Request: %*" PRIu64 "/%*" PRIu64 ", ACK: %*" PRIu64 "/%*" PRIu64 "\n", IF_NAMESIZE, vlan_intf, (int) strlen(counter_desc[type]), counter_desc[type], DHCP_COUNTER_WIDTH, counters[DHCP_RX][DHCP_MESSAGE_TYPE_DISCOVER],