flow/bypass: add util func to check if flow is bypassed

To hide the ifdefs for capture offload.

(cherry picked from commit b19d1df69f)
pull/6824/head
Victor Julien 5 years ago committed by Shivani Bhardwaj
parent 95f3a06c3a
commit 16bf8a6ee4

@ -275,11 +275,7 @@ static uint32_t ProcessAsideQueue(FlowManagerTimeoutThread *td, FlowTimeoutCount
/* flow is still locked */
if (f->proto == IPPROTO_TCP && !(f->flags & FLOW_TIMEOUT_REASSEMBLY_DONE) &&
#ifdef CAPTURE_OFFLOAD
f->flow_state != FLOW_STATE_CAPTURE_BYPASSED &&
#endif
f->flow_state != FLOW_STATE_LOCAL_BYPASSED &&
FlowForceReassemblyNeedReassembly(f) == 1) {
!FlowIsBypassed(f) && FlowForceReassemblyNeedReassembly(f) == 1) {
/* Send the flow to its thread */
FlowForceReassemblyForFlow(f);
FLOWLOCK_UNLOCK(f);

@ -171,16 +171,9 @@ static void CheckWorkQueue(ThreadVars *tv, FlowWorkerThreadData *fw,
FLOWLOCK_WRLOCK(f);
f->flow_end_flags |= FLOW_END_FLAG_TIMEOUT; //TODO emerg
const FlowStateType state = f->flow_state;
if (f->proto == IPPROTO_TCP) {
if (!(f->flags & FLOW_TIMEOUT_REASSEMBLY_DONE) &&
#ifdef CAPTURE_OFFLOAD
state != FLOW_STATE_CAPTURE_BYPASSED &&
#endif
state != FLOW_STATE_LOCAL_BYPASSED &&
FlowForceReassemblyNeedReassembly(f) == 1 &&
f->ffr != 0)
{
if (!(f->flags & FLOW_TIMEOUT_REASSEMBLY_DONE) && !FlowIsBypassed(f) &&
FlowForceReassemblyNeedReassembly(f) == 1 && f->ffr != 0) {
int cnt = FlowFinish(tv, f, fw, detect_thread);
counters->flows_aside_pkt_inject += cnt;
counters->flows_aside_needs_work++;

@ -697,6 +697,18 @@ static inline void FlowSetEndFlags(Flow *f)
#endif
}
static inline bool FlowIsBypassed(const Flow *f)
{
if (
#ifdef CAPTURE_OFFLOAD
f->flow_state == FLOW_STATE_CAPTURE_BYPASSED ||
#endif
f->flow_state == FLOW_STATE_LOCAL_BYPASSED) {
return true;
}
return false;
}
int FlowClearMemory(Flow *,uint8_t );
AppProto FlowGetAppProtocol(const Flow *f);

Loading…
Cancel
Save