int g_bypassed_func_max_index = 0;
BypassedCheckFunc BypassedFuncList[BYPASSFUNCMAX];
+int g_bypassed_update_max_index = 0;
+BypassedUpdateFunc UpdateFuncList[BYPASSFUNCMAX];
+
static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data)
{
#ifdef HAVE_PACKET_EBPF
return TM_ECODE_OK;
}
+void BypassedFlowUpdate(Flow *f, Packet *p)
+{
+ int i;
+
+ for (i = 0; i < g_bypassed_update_max_index; i++) {
+ if (UpdateFuncList[i](f, p)) {
+ return;
+ }
+ }
+}
static TmEcode BypassedFlowManagerThreadInit(ThreadVars *t, const void *initdata, void **data)
{
return 0;
}
+int BypassedFlowManagerRegisterUpdateFunc(BypassedUpdateFunc UpdateFunc)
+{
+ if (!UpdateFunc) {
+ return -1;
+ }
+ if (g_bypassed_update_max_index < BYPASSFUNCMAX) {
+ UpdateFuncList[g_bypassed_update_max_index] = UpdateFunc;
+ g_bypassed_update_max_index++;
+ } else {
+ return -1;
+ }
+ return 0;
+}
+
void TmModuleBypassedFlowManagerRegister (void)
{
tmm_modules[TMM_BYPASSEDFLOWMANAGER].name = "BypassedFlowManager";
typedef int (*BypassedCheckFunc)(struct flows_stats *bypassstats,
struct timespec *curtime);
+typedef int (*BypassedUpdateFunc)(Flow *f, Packet *p);
void FlowAddToBypassed(Flow *f);
void TmModuleBypassedFlowManagerRegister(void);
int BypassedFlowManagerRegisterCheckFunc(BypassedCheckFunc CheckFunc);
+int BypassedFlowManagerRegisterUpdateFunc(BypassedUpdateFunc UpdateFunc);
+
+void BypassedFlowUpdate(Flow *f, Packet *p);
#endif
#include "flow-timeout.h"
#include "flow-manager.h"
#include "flow-storage.h"
+#include "flow-bypass.h"
#include "stream-tcp-private.h"
#include "stream-tcp-reassemble.h"
SCLogDebug("Downgrading flow to local bypass");
COPY_TIMESTAMP(&p->ts, &f->lastts);
FlowUpdateState(f, FLOW_STATE_LOCAL_BYPASSED);
+ } else {
+ /* In IPS mode the packet could come from the over interface so it would
+ * need to be bypassed */
+ if (EngineModeIsIPS()) {
+ BypassedFlowUpdate(f, p);
+ }
}
}