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