24#ifndef SURICATA_UTIL_EBPF_H
25#define SURICATA_UTIL_EBPF_H
30#ifdef HAVE_PACKET_EBPF
32#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0)
33#define XDP_FLAGS_SKB_MODE (1U << 1)
34#define XDP_FLAGS_DRV_MODE (1U << 2)
35#define XDP_FLAGS_HW_MODE (1U << 3)
69typedef struct EBPFBypassData_ {
75#define EBPF_SOCKET_FILTER (1<<0)
76#define EBPF_XDP_CODE (1<<1)
77#define EBPF_PINNED_MAPS (1<<2)
78#define EBPF_XDP_HW_MODE (1<<3)
80int EBPFGetMapFDByName(
const char *iface,
const char *
name);
81int EBPFLoadFile(
const char *iface,
const char *path,
const char * section,
82 int *val,
struct ebpf_timeout_config *config);
83int EBPFSetupXDP(
const char *iface,
int fd, uint8_t
flags);
85int EBPFCheckBypassedFlowCreate(
ThreadVars *th_v,
struct timespec *curtime,
void *data);
87void EBPFRegisterExtension(
void);
89void EBPFBuildCPUSet(
SCConfNode *node,
char *iface);
91int EBPFSetPeerIface(
const char *iface,
const char *out_iface);
93int EBPFUpdateFlow(
Flow *f,
Packet *p,
void *data);
94bool EBPFBypassUpdate(
Flow *f,
void *data, time_t tsec);
95void EBPFBypassFree(
void *data);
97void EBPFDeleteKey(
int fd,
void *key);
99#define __bpf_percpu_val_align __attribute__((__aligned__(8)))
101#define BPF_DECLARE_PERCPU(type, name, nr_cpus) \
102 struct { type v; } __bpf_percpu_val_align \
104#define BPF_PERCPU(name, cpu) name[(cpu)].v
Per thread variable structure.