Skip to content

Commit

Permalink
fix counter log issue on 32bits platform (#16357)
Browse files Browse the repository at this point in the history
Cherry pick sonic-net/sonic-dhcpmon#11 into 202205.
  • Loading branch information
jcaiMR authored Sep 5, 2023
1 parent 874ca68 commit 8787b71
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/dhcpmon/src/dhcp_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <arpa/inet.h>
#include <unistd.h>
#include <syslog.h>
#include <inttypes.h>
#include <libexplain/ioctl.h>
#include <linux/filter.h>
#include <netpacket/packet.h>
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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],
Expand Down

0 comments on commit 8787b71

Please sign in to comment.