decode: implement bypass function

Call the packet bypass callback if necessary and update the flow
state. In case of failure we switch to local bypassed state and set
capture bypassed state if the callback is successful.
pull/2302/head
Eric Leblond 9 years ago committed by Victor Julien
parent 68d9677eea
commit 285b4dd981

@ -384,8 +384,18 @@ void PacketDefragPktSetupParent(Packet *parent)
void PacketBypassCallback(Packet *p) void PacketBypassCallback(Packet *p)
{ {
if (p->BypassPacketsFlow) { /* Don't try to bypass if flow is already out or
p->BypassPacketsFlow(p); * if we have failed to do it once */
int state = SC_ATOMIC_GET(p->flow->flow_state);
if ((state == FLOW_STATE_LOCAL_BYPASSED) ||
(state == FLOW_STATE_CAPTURE_BYPASSED)) {
return;
}
if (p->BypassPacketsFlow && p->BypassPacketsFlow(p)) {
FlowUpdateState(p->flow, FLOW_STATE_CAPTURE_BYPASSED);
} else {
FlowUpdateState(p->flow, FLOW_STATE_LOCAL_BYPASSED);
} }
} }

Loading…
Cancel
Save