]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream/unittests: fix failures after last_ack fix
authorVictor Julien <vjulien@oisf.net>
Fri, 22 Apr 2022 17:33:13 +0000 (19:33 +0200)
committerJeff Lucovsky <jeff@lucovsky.org>
Sun, 29 May 2022 19:23:24 +0000 (15:23 -0400)
Work around many tests not setting up stream completely or correctly.

(cherry picked from commit 3d6e733aa7297f64fe87cc3b59fbbd9a527513fa)

src/stream-tcp-reassemble.h

index e2f388eb23a4f957fe7fe365df481749cc3e75a2..275c87d973537e6a1bcf55ec19a3e5226f7153a4 100644 (file)
@@ -133,8 +133,14 @@ void StreamTcpReassemblySetMinInspectDepth(TcpSession *ssn, int direction, uint3
 static inline bool STREAM_LASTACK_GT_BASESEQ(const TcpStream *stream)
 {
     /* last ack not yet initialized */
-    if (STREAM_BASE_OFFSET(stream) == 0 && (stream->tcp_flags & TH_ACK) == 0)
+    if (STREAM_BASE_OFFSET(stream) == 0 && (stream->tcp_flags & TH_ACK) == 0) {
+#ifdef UNITTESTS
+        if (RunmodeIsUnittests() && stream->last_ack == 0)
+            return false;
+#else
         return false;
+#endif
+    }
     if (SEQ_GT(stream->last_ack, stream->base_seq))
         return true;
     return false;