]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
checksum: use u64 types
authorVictor Julien <victor@inliniac.net>
Fri, 22 Feb 2019 21:01:37 +0000 (22:01 +0100)
committerVictor Julien <victor@inliniac.net>
Sun, 24 Feb 2019 19:00:55 +0000 (20:00 +0100)
src/util-checksum.c
src/util-checksum.h

index 245f3b6908ca4983b2cac012449b1e037f9e5ceb..3580e85def340455d05ea06eae08744d87c9b352 100644 (file)
@@ -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;
index dc14334cbd53f649916242857375fed7b311fed5..eb2767e9b4a9f79e568457088161777e89f64dd0 100644 (file)
 #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