]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream/tcp: fix async mode ACK validation
authorVictor Julien <victor@inliniac.net>
Thu, 17 Dec 2020 09:54:05 +0000 (10:54 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 24 Dec 2020 08:57:52 +0000 (09:57 +0100)
(cherry picked from commit 8aa02c6d15f013f9ce934e440ee073701d3ea502)

src/stream-tcp.c

index a99ce68b65b29d8330aa1b1e71718fac5f7d32ab..8683af70fcae96171be57aef9c2ebbc5c7bbd168 100644 (file)
@@ -2014,8 +2014,7 @@ static int StreamTcpPacketStateSynRecv(ThreadVars *tv, Packet *p,
 
             if (ssn->flags & STREAMTCP_FLAG_MIDSTREAM) {
                 ssn->server.window = TCP_GET_WINDOW(p);
-                ssn->client.next_win = ssn->server.last_ack +
-                    ssn->server.window;
+                ssn->server.next_win = ssn->server.last_ack + ssn->server.window;
                 /* window scaling for midstream pickups, we can't do much
                  * other than assume that it's set to the max value: 14 */
                 ssn->server.wscale = TCP_WSCALE_MAX;
@@ -5828,6 +5827,11 @@ static inline int StreamTcpValidateAck(TcpSession *ssn, TcpStream *stream, Packe
         SCReturnInt(0);
     }
 
+    /* no further checks possible for ASYNC */
+    if ((ssn->flags & STREAMTCP_FLAG_ASYNC) != 0) {
+        SCReturnInt(0);
+    }
+
     if (ssn->state > TCP_SYN_SENT && SEQ_GT(ack, stream->next_win)) {
         SCLogDebug("ACK %"PRIu32" is after next_win %"PRIu32, ack, stream->next_win);
         goto invalid;