From 317e045163093defaef6abedaad8229cbf79da04 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 23 Dec 2020 15:55:19 +0100 Subject: [PATCH] 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. (cherry picked from commit 49bd1f85b99e8bd473ae28c6eb93510b2b3c7668) --- src/flow-timeout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/flow-timeout.c b/src/flow-timeout.c index c5dafb06f8..32063bc733 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); -- 2.47.2