]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream/async: improve handling of syn/ack pickup 1194/head
authorVictor Julien <victor@inliniac.net>
Thu, 30 Oct 2014 10:07:38 +0000 (11:07 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 30 Oct 2014 10:07:38 +0000 (11:07 +0100)
If we picked up the ssn with a syn/ack, we don't need to make more
assumptions about sack and wscale after that.

src/stream-tcp.c

index 76b256bc998685b89ab9e6c99eb63043af4fbd09..5bb30f614a8cd36c1b51d536245f42eb685f464d 100644 (file)
@@ -1774,11 +1774,13 @@ static int StreamTcpPacketStateSynRecv(ThreadVars *tv, Packet *p,
                 ssn->client.next_win = ssn->client.last_ack + ssn->client.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;
-                ssn->client.wscale = TCP_WSCALE_MAX;
-                ssn->flags |= STREAMTCP_FLAG_SACKOK;
+                if (!(ssn->flags & STREAMTCP_FLAG_MIDSTREAM_SYNACK)) {
+                    /* 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;
+                    ssn->client.wscale = TCP_WSCALE_MAX;
+                    ssn->flags |= STREAMTCP_FLAG_SACKOK;
+                }
             }
 
             StreamTcpPacketSetState(p, ssn, TCP_ESTABLISHED);