flow/inject: Ensure initialized thread value used

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 9ad73faa0a)
pull/10771/head
Jeff Lucovsky 2 years ago committed by Jeff Lucovsky
parent 80d2c6e0a1
commit 4331da4b67

@ -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]);
}
/**

Loading…
Cancel
Save