}
for (i = 0; i < g_bypassed_func_max_index; i++) {
if (bypassedfunclist[i].FuncInit) {
- bypassedfunclist[i].FuncInit(&curtime, bypassedfunclist[i].data);
+ bypassedfunclist[i].FuncInit(th_v, &curtime, bypassedfunclist[i].data);
}
}
}
for (i = 0; i < g_bypassed_func_max_index; i++) {
struct flows_stats bypassstats = { 0, 0, 0};
- tcount = bypassedfunclist[i].Func(&bypassstats, &curtime, bypassedfunclist[i].data);
+ tcount = bypassedfunclist[i].Func(th_v, &bypassstats, &curtime, bypassedfunclist[i].data);
if (tcount) {
StatsAddUI64(th_v, ftd->flow_bypassed_cnt_clo, (uint64_t)bypassstats.count);
StatsAddUI64(th_v, ftd->flow_bypassed_pkts, (uint64_t)bypassstats.packets);
#include "flow-storage.h"
#include "flow.h"
#include "flow-hash.h"
+#include "tm-threads.h"
#include <bpf/libbpf.h>
#include <bpf/bpf.h>
* This function iterates on all the flows of the IPv4 table
* looking for timeouted flow to delete from the flow table.
*/
-static int EBPFForEachFlowV4Table(LiveDevice *dev, const char *name,
+static int EBPFForEachFlowV4Table(ThreadVars *th_v, LiveDevice *dev, const char *name,
struct flows_stats *flowstats,
struct timespec *ctime,
struct ebpf_timeout_config *tcfg,
if (pkts_cnt > 0) {
found = 1;
}
+
+ if (TmThreadsCheckFlag(th_v, THV_KILL)) {
+ return 0;
+ }
+
key = next_key;
}
if (pkts_cnt > 0) {
* This function iterates on all the flows of the IPv4 table
* looking for timeouted flow to delete from the flow table.
*/
-static int EBPFForEachFlowV6Table(LiveDevice *dev, const char *name,
+static int EBPFForEachFlowV6Table(ThreadVars *th_v,
+ LiveDevice *dev, const char *name,
struct flows_stats *flowstats,
struct timespec *ctime,
struct ebpf_timeout_config *tcfg,
if (pkts_cnt > 0) {
found = 1;
}
+
+ if (TmThreadsCheckFlag(th_v, THV_KILL)) {
+ return 0;
+ }
+
key = next_key;
}
if (pkts_cnt > 0) {
}
-int EBPFCheckBypassedFlowCreate(struct timespec *curtime, void *data)
+int EBPFCheckBypassedFlowCreate(ThreadVars *th_v, struct timespec *curtime, void *data)
{
struct flows_stats local_bypassstats = { 0, 0, 0};
LiveDevice *ldev = NULL, *ndev;
struct ebpf_timeout_config *cfg = (struct ebpf_timeout_config *)data;
while(LiveDeviceForEach(&ldev, &ndev)) {
- EBPFForEachFlowV4Table(ldev, "flow_table_v4",
+ EBPFForEachFlowV4Table(th_v, ldev, "flow_table_v4",
&local_bypassstats, curtime,
cfg, EBPFCreateFlowForKey);
- EBPFForEachFlowV6Table(ldev, "flow_table_v6",
+ EBPFForEachFlowV6Table(th_v, ldev, "flow_table_v6",
&local_bypassstats, curtime,
cfg, EBPFCreateFlowForKey);
}
* of entries in the kernel/userspace flow table if needed.
*
*/
-int EBPFCheckBypassedFlowTimeout(struct flows_stats *bypassstats,
+int EBPFCheckBypassedFlowTimeout(ThreadVars *th_v, struct flows_stats *bypassstats,
struct timespec *curtime,
void *data)
{
while(LiveDeviceForEach(&ldev, &ndev)) {
memset(&local_bypassstats, 0, sizeof(local_bypassstats));
- tcount = EBPFForEachFlowV4Table(ldev, "flow_table_v4",
+ tcount = EBPFForEachFlowV4Table(th_v, ldev, "flow_table_v4",
&local_bypassstats, curtime,
cfg, EBPFUpdateFlowForKey);
bypassstats->count = local_bypassstats.count;
ret = 1;
}
memset(&local_bypassstats, 0, sizeof(local_bypassstats));
- tcount = EBPFForEachFlowV6Table(ldev, "flow_table_v6",
+ tcount = EBPFForEachFlowV6Table(th_v, ldev, "flow_table_v6",
&local_bypassstats, curtime,
cfg, EBPFUpdateFlowForKey);
bypassstats->count += local_bypassstats.count;