Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(7.0.x backport) flow: Use proper thread id for injection #10738

Merged
merged 2 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/flow-timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,21 @@ int FlowForceReassemblyNeedReassembly(Flow *f)
*
* The function requires flow to be locked beforehand.
*
* Normally, the first thread_id value should be used. This is when the flow is
* created on seeing the first packet to the server; sometimes, if the first
* packet is determined to be to the client, the second thread_id value should
* be used.
*
* \param f Pointer to the flow.
*
* \retval 0 This flow doesn't need any reassembly processing; 1 otherwise.
*/
void FlowForceReassemblyForFlow(Flow *f)
{
const int thread_id = (int)f->thread_id[0];
TmThreadsInjectFlowById(f, thread_id);
// Have packets traveled to the server? If not,
// use the reverse direction
int idx = f->todstpktcnt > 0 ? 0 : 1;
TmThreadsInjectFlowById(f, (const int)f->thread_id[idx]);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ void FlowSwap(Flow *f)
FlowSwapFlags(f);
FlowSwapFileFlags(f);

SWAP_VARS(FlowThreadId, f->thread_id[0], f->thread_id[1]);

if (f->proto == IPPROTO_TCP) {
TcpStreamFlowSwap(f);
}
Expand Down
Loading