]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow/timeout: fix TCP seq/ack for reversed flows 5678/head
authorVictor Julien <victor@inliniac.net>
Wed, 23 Dec 2020 14:55:19 +0000 (15:55 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 23 Dec 2020 15:35:43 +0000 (16:35 +0100)
When a flow is swapped it also swaps the stream trackers, so it does
not make sense to reverse them during pseudo packet creation.

src/flow-timeout.c

index d5deb190d0831effbf05f402423f21280400d23e..972b35076bdf27776f07abac1328d0bbf8afc792 100644 (file)
@@ -80,6 +80,7 @@ static inline Packet *FlowForceReassemblyPseudoPacketSetup(Packet *p,
                                                            Flow *f,
                                                            TcpSession *ssn)
 {
+    const int orig_dir = direction;
     p->tenant_id = f->tenant_id;
     p->datalink = DLT_RAW;
     p->proto = IPPROTO_TCP;
@@ -217,7 +218,7 @@ static inline Packet *FlowForceReassemblyPseudoPacketSetup(Packet *p,
     p->tcph->th_urp = 0;
 
     /* to server */
-    if (direction == 0) {
+    if (orig_dir == 0) {
         p->tcph->th_sport = htons(f->sp);
         p->tcph->th_dport = htons(f->dp);