]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream-tcp: no checksum alert if validation is off
authorEric Leblond <eric@regit.org>
Thu, 16 Aug 2012 06:57:19 +0000 (08:57 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 16 Aug 2012 10:42:38 +0000 (12:42 +0200)
This patch disables checksum alert if checksum-validation is set
to no in the configuration file. Without this patch, when parsing
a pcap which checksum offloading, it was not possible to get rid
of event caused by checksum validation.

src/stream-tcp.c

index 01a132faf8f2bc19015ed5de806be8a644d3cc75..5e4c010a11b48072d51414e0d3538654fdf742c2 100644 (file)
@@ -380,7 +380,7 @@ void StreamTcpInitConfig(char quiet)
     if ((ConfGetBool("stream.checksum-validation", &csum)) == 1) {
         if (csum == 1) {
             stream_config.flags |= STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION;
-       }
+        }
     /* Default is that we validate the checksum of all the packets */
     } else {
         stream_config.flags |= STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION;
@@ -3737,11 +3737,13 @@ TmEcode StreamTcp (ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, Packe
         return TM_ECODE_OK;
     }
 
-    if ((stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION) &&
-            (StreamTcpValidateChecksum(p) == 0))
-    {
-        SCPerfCounterIncr(stt->counter_tcp_invalid_checksum, tv->sc_perf_pca);
-        return TM_ECODE_OK;
+    if (stream_config.flags & STREAMTCP_INIT_FLAG_CHECKSUM_VALIDATION) {
+        if (StreamTcpValidateChecksum(p) == 0) {
+            SCPerfCounterIncr(stt->counter_tcp_invalid_checksum, tv->sc_perf_pca);
+            return TM_ECODE_OK;
+        }
+    } else {
+        p->flags |= PKT_IGNORE_CHECKSUM;
     }
 
     PACKET_PROFILING_APP_RESET(&stt->ra_ctx->dp_ctx);