]>
Commit | Line | Data |
---|---|---|
e6f30c73 WB |
1 | #ifndef _XT_BPF_H |
2 | #define _XT_BPF_H | |
3 | ||
4 | #include <linux/filter.h> | |
2c16d603 | 5 | #include <linux/limits.h> |
e6f30c73 WB |
6 | #include <linux/types.h> |
7 | ||
8 | #define XT_BPF_MAX_NUM_INSTR 64 | |
2c16d603 | 9 | #define XT_BPF_PATH_MAX (XT_BPF_MAX_NUM_INSTR * sizeof(struct sock_filter)) |
e6f30c73 | 10 | |
7ae457c1 | 11 | struct bpf_prog; |
e10038a8 | 12 | |
e6f30c73 WB |
13 | struct xt_bpf_info { |
14 | __u16 bpf_program_num_elem; | |
15 | struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; | |
16 | ||
17 | /* only used in the kernel */ | |
7ae457c1 | 18 | struct bpf_prog *filter __attribute__((aligned(8))); |
e6f30c73 WB |
19 | }; |
20 | ||
2c16d603 WB |
21 | enum xt_bpf_modes { |
22 | XT_BPF_MODE_BYTECODE, | |
23 | XT_BPF_MODE_FD_PINNED, | |
24 | XT_BPF_MODE_FD_ELF, | |
25 | }; | |
26 | ||
27 | struct xt_bpf_info_v1 { | |
28 | __u16 mode; | |
29 | __u16 bpf_program_num_elem; | |
30 | __s32 fd; | |
31 | union { | |
32 | struct sock_filter bpf_program[XT_BPF_MAX_NUM_INSTR]; | |
33 | char path[XT_BPF_PATH_MAX]; | |
34 | }; | |
35 | ||
36 | /* only used in the kernel */ | |
37 | struct bpf_prog *filter __attribute__((aligned(8))); | |
38 | }; | |
39 | ||
e6f30c73 | 40 | #endif /*_XT_BPF_H */ |