]> 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>
Fri, 22 Apr 2022 17:33:15 +0000 (19:33 +0200)
Work around many tests not setting up stream completely or correctly.

src/stream-tcp-reassemble.h

index 24ff9f261da36b2375c913cf6da9bf9d129fc94e..02911bd820f3919c3c6912a7715cded884976070 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;