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

To hide the ifdefs for capture offload.
pull/6539/head
Victor Julien 4 years ago
parent ab8f289bb6
commit b19d1df69f

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

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

@ -707,6 +707,18 @@ static inline void FlowSetEndFlags(Flow *f)
#endif #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 ); int FlowClearMemory(Flow *,uint8_t );
AppProto FlowGetAppProtocol(const Flow *f); AppProto FlowGetAppProtocol(const Flow *f);

Loading…
Cancel
Save