]> 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>
Wed, 23 Dec 2020 08:43:53 +0000 (09:43 +0100)
src/stream-tcp.c

index 59c3da97ff46aa3c80ee94a00fb494a31c9fb669..a54b9fd9b6f27a05d5bca558fced1dc5957872ff 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;
@@ -5810,6 +5809,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;