From: Victor Julien Date: Fri, 22 Feb 2019 21:01:37 +0000 (+0100) Subject: checksum: use u64 types X-Git-Tag: suricata-5.0.0-beta1~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf905bcbca711b571f786d59d7285cd0d6c72d53;p=thirdparty%2Fsuricata.git checksum: use u64 types --- diff --git a/src/util-checksum.c b/src/util-checksum.c index 245f3b6908..3580e85def 100644 --- a/src/util-checksum.c +++ b/src/util-checksum.c @@ -67,23 +67,26 @@ int ReCalculateChecksum(Packet *p) * \retval 1 yes, offloading in place * \retval 0 no, no offloading used */ -int ChecksumAutoModeCheck(uint32_t thread_count, - unsigned int iface_count, unsigned int iface_fail) +int ChecksumAutoModeCheck(uint64_t thread_count, + uint64_t iface_count, uint64_t iface_fail) { if (thread_count == CHECKSUM_SAMPLE_COUNT) { if (iface_fail != 0) { if ((iface_count / iface_fail) < CHECKSUM_INVALID_RATIO) { SCLogInfo("More than 1/%dth of packets have an invalid " - "checksum, assuming checksum offloading is used (%u/%u)", + "checksum, assuming checksum offloading is used " + "(%"PRIu64"/%"PRIu64")", CHECKSUM_INVALID_RATIO, iface_fail, iface_count); return 1; } else { SCLogInfo("Less than 1/%dth of packets have an invalid " - "checksum, assuming checksum offloading is NOT used (%u/%u)", - CHECKSUM_INVALID_RATIO, iface_fail, iface_count); + "checksum, assuming checksum offloading is NOT used " + "(%"PRIu64"/%"PRIu64")", CHECKSUM_INVALID_RATIO, + iface_fail, iface_count); } } else { - SCLogInfo("No packets with invalid checksum, assuming checksum offloading is NOT used"); + SCLogInfo("No packets with invalid checksum, assuming " + "checksum offloading is NOT used"); } } return 0; diff --git a/src/util-checksum.h b/src/util-checksum.h index dc14334cbd..eb2767e9b4 100644 --- a/src/util-checksum.h +++ b/src/util-checksum.h @@ -25,12 +25,12 @@ #define __UTIL_CHECKSUM_H__ int ReCalculateChecksum(Packet *p); -int ChecksumAutoModeCheck(uint32_t thread_count, - unsigned int iface_count, unsigned int iface_fail); +int ChecksumAutoModeCheck(uint64_t thread_count, + uint64_t iface_count, uint64_t iface_fail); /* constant linked with detection of interface with * invalid checksums */ -#define CHECKSUM_SAMPLE_COUNT 1000 +#define CHECKSUM_SAMPLE_COUNT 1000ULL #define CHECKSUM_INVALID_RATIO 10 #endif