Go to the documentation of this file.
24 #ifndef SURICATA_SOURCE_AFP_H
25 #define SURICATA_SOURCE_AFP_H
27 #ifndef HAVE_PACKET_FANOUT
28 #define HAVE_PACKET_FANOUT 1
30 #define PACKET_FANOUT 18
32 #define PACKET_FANOUT_HASH 0
33 #define PACKET_FANOUT_LB 1
34 #define PACKET_FANOUT_CPU 2
35 #define PACKET_FANOUT_ROLLOVER 3
36 #define PACKET_FANOUT_RND 4
37 #define PACKET_FANOUT_QM 5
39 #define PACKET_FANOUT_FLAG_ROLLOVER 0x1000
40 #define PACKET_FANOUT_FLAG_DEFRAG 0x8000
42 #include <linux/if_packet.h>
46 #ifdef HAVE_PACKET_EBPF
47 #define AFP_MODE_XDP_BYPASS 1
48 #define AFP_MODE_EBPF_BYPASS 2
49 struct ebpf_timeout_config {
50 const char *pinned_maps_name;
58 #define AFP_NEED_PEER (1 << 0)
60 #define AFP_SOCK_PROTECT (1<<2)
61 #define AFP_EMERGENCY_MODE (1<<3)
62 #define AFP_TPACKET_V3 (1<<4)
63 #define AFP_VLAN_IN_HEADER (1<<5)
64 #define AFP_MMAP_LOCKED (1<<6)
65 #define AFP_BYPASS (1<<7)
66 #define AFP_XDPBYPASS (1<<8)
68 #define AFP_COPY_MODE_NONE 0
69 #define AFP_COPY_MODE_TAP 1
70 #define AFP_COPY_MODE_IPS 2
72 #define AFP_IFACE_NAME_LENGTH 48
78 #define AFP_BLOCK_SIZE_DEFAULT_ORDER 3
111 #ifdef HAVE_PACKET_EBPF
112 struct ebpf_timeout_config ebpf_t_config;
153 #ifdef HAVE_PACKET_EBPF
156 unsigned int nr_cpus;
160 #ifdef HAVE_PACKET_EBPF
161 #define AFPV_CLEANUP(afpv) \
163 (afpv)->relptr = NULL; \
164 (afpv)->copy_mode = 0; \
165 (afpv)->vlan_tci = 0; \
166 (afpv)->peer = NULL; \
167 (afpv)->mpeer = NULL; \
168 (afpv)->v4_map_fd = -1; \
169 (afpv)->v6_map_fd = -1; \
172 #define AFPV_CLEANUP(afpv) \
174 (afpv)->relptr = NULL; \
175 (afpv)->copy_mode = 0; \
176 (afpv)->vlan_tci = 0; \
177 (afpv)->peer = NULL; \
178 (afpv)->mpeer = NULL; \
ChecksumValidationMode checksum_mode
TAILQ_ENTRY(AFPPeer_) next
struct AFPPacketVars_ AFPPacketVars
per packet AF_PACKET vars
struct HtpBodyChunk_ * next
SC_ATOMIC_DECLARE(int, sock_usage)
TmEcode AFPPeersListInit(void)
Init the global list of AFPPeer.
void TmModuleDecodeAFPRegister(void)
Registration Function for DecodeAFP.
SC_ATOMIC_DECLARE(int, socket)
SC_ATOMIC_DECLARE(int, if_idx)
void AFPPeersListClean(void)
Clean the global peers list.
int AFPGetLinkType(const char *ifname)
struct AFPIfaceConfig_ AFPIfaceConfig
TmEcode AFPPeersListCheck(void)
Check that all AFPPeer got a peer.
SC_ATOMIC_DECLARE(uint8_t, state)
const char * ebpf_filter_file
void TmModuleReceiveAFPRegister(void)
Registration Function for RecieveAFP.
void(* DerefFunc)(void *)
SC_ATOMIC_DECLARE(uint64_t, send_errors)
const char * xdp_filter_file
#define AFP_IFACE_NAME_LENGTH
char iface[AFP_IFACE_NAME_LENGTH]
per packet AF_PACKET vars
char iface[AFP_IFACE_NAME_LENGTH]
const char * ebpf_lb_file
SC_ATOMIC_DECLARE(unsigned int, ref)
int AFPIsFanoutSupported(uint16_t cluster_id)
test if we can use FANOUT. Older kernels like those in CentOS6 have HAVE_PACKET_FANOUT defined but fa...