Skip to content

Commit

Permalink
flow/inject: Ensure initialized thread value used
Browse files Browse the repository at this point in the history
Issue: 6835

When injecting a flow, ensure that the selected thread_id has been
initialized. When a flow is picked up midstream, the initialized thread
can be the second thread element.

(cherry picked from commit 9ad73fa)
  • Loading branch information
jlucovsky committed Mar 30, 2024
1 parent 80d2c6e commit 4331da4
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit 4331da4

Please sign in to comment.