]> 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)
committerVictor Julien <vjulien@oisf.net>
Wed, 27 Apr 2022 09:14:27 +0000 (11:14 +0200)
Work around many tests not setting up stream completely or correctly.

(cherry picked from commit 3d6e733aa7297f64fe87cc3b59fbbd9a527513fa)

src/stream-tcp-reassemble.h

index 11d616a99517964211ab14322328189a403424b0..0e2ea46fae087f12011c8172e4ddcfa74a6d536f 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;