From: Victor Julien Date: Wed, 23 Dec 2020 14:55:19 +0000 (+0100) Subject: flow/timeout: fix TCP seq/ack for reversed flows X-Git-Tag: suricata-7.0.0-beta1~1931 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5678%2Fhead;p=thirdparty%2Fsuricata.git flow/timeout: fix TCP seq/ack for reversed flows When a flow is swapped it also swaps the stream trackers, so it does not make sense to reverse them during pseudo packet creation. --- diff --git a/src/flow-timeout.c b/src/flow-timeout.c index d5deb190d0..972b35076b 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -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);