Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
96518518 PM |
2 | #ifndef _NET_NF_TABLES_CORE_H |
3 | #define _NET_NF_TABLES_CORE_H | |
4 | ||
a654de8f PNA |
5 | #include <net/netfilter/nf_tables.h> |
6 | ||
4e24877e LZ |
7 | extern struct nft_expr_type nft_imm_type; |
8 | extern struct nft_expr_type nft_cmp_type; | |
9 | extern struct nft_expr_type nft_lookup_type; | |
10 | extern struct nft_expr_type nft_bitwise_type; | |
11 | extern struct nft_expr_type nft_byteorder_type; | |
12 | extern struct nft_expr_type nft_payload_type; | |
13 | extern struct nft_expr_type nft_dynset_type; | |
14 | extern struct nft_expr_type nft_range_type; | |
8a22543c | 15 | extern struct nft_expr_type nft_meta_type; |
ae1bc6a9 | 16 | extern struct nft_expr_type nft_rt_type; |
d0103158 | 17 | extern struct nft_expr_type nft_exthdr_type; |
4e24877e | 18 | |
fb961945 CG |
19 | #ifdef CONFIG_NETWORK_SECMARK |
20 | extern struct nft_object_type nft_secmark_obj_type; | |
21 | #endif | |
22 | ||
5eccdfaa JP |
23 | int nf_tables_core_module_init(void); |
24 | void nf_tables_core_module_exit(void); | |
96518518 | 25 | |
cb7dbfd0 PM |
26 | struct nft_cmp_fast_expr { |
27 | u32 data; | |
28 | enum nft_registers sreg:8; | |
29 | u8 len; | |
30 | }; | |
31 | ||
a654de8f PNA |
32 | struct nft_immediate_expr { |
33 | struct nft_data data; | |
34 | enum nft_registers dreg:8; | |
35 | u8 dlen; | |
36 | }; | |
37 | ||
b855d416 PM |
38 | /* Calculate the mask for the nft_cmp_fast expression. On big endian the |
39 | * mask needs to include the *upper* bytes when interpreting that data as | |
40 | * something smaller than the full u32, therefore a cpu_to_le32 is done. | |
41 | */ | |
42 | static inline u32 nft_cmp_fast_mask(unsigned int len) | |
43 | { | |
44 | return cpu_to_le32(~0U >> (FIELD_SIZEOF(struct nft_cmp_fast_expr, | |
45 | data) * BITS_PER_BYTE - len)); | |
46 | } | |
47 | ||
cb7dbfd0 PM |
48 | extern const struct nft_expr_ops nft_cmp_fast_ops; |
49 | ||
c29b72e0 PM |
50 | struct nft_payload { |
51 | enum nft_payload_bases base:8; | |
52 | u8 offset; | |
53 | u8 len; | |
54 | enum nft_registers dreg:8; | |
55 | }; | |
56 | ||
7ec3f7b4 PM |
57 | struct nft_payload_set { |
58 | enum nft_payload_bases base:8; | |
59 | u8 offset; | |
60 | u8 len; | |
61 | enum nft_registers sreg:8; | |
62 | u8 csum_type; | |
63 | u8 csum_offset; | |
18140969 | 64 | u8 csum_flags; |
7ec3f7b4 PM |
65 | }; |
66 | ||
c29b72e0 | 67 | extern const struct nft_expr_ops nft_payload_fast_ops; |
9f08ea84 PNA |
68 | |
69 | extern struct static_key_false nft_counters_enabled; | |
e639f7ab | 70 | extern struct static_key_false nft_trace_enabled; |
c29b72e0 | 71 | |
e240cd0d PNA |
72 | extern struct nft_set_type nft_set_rhash_type; |
73 | extern struct nft_set_type nft_set_hash_type; | |
74 | extern struct nft_set_type nft_set_hash_fast_type; | |
75 | extern struct nft_set_type nft_set_rbtree_type; | |
76 | extern struct nft_set_type nft_set_bitmap_type; | |
77 | ||
222440b4 FW |
78 | struct nft_expr; |
79 | struct nft_regs; | |
80 | struct nft_pktinfo; | |
81 | void nft_meta_get_eval(const struct nft_expr *expr, | |
82 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
10870dd8 FW |
83 | void nft_cmp_eval(const struct nft_expr *expr, |
84 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
222440b4 FW |
85 | void nft_lookup_eval(const struct nft_expr *expr, |
86 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
10870dd8 FW |
87 | void nft_payload_eval(const struct nft_expr *expr, |
88 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
89 | void nft_immediate_eval(const struct nft_expr *expr, | |
90 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
91 | void nft_bitwise_eval(const struct nft_expr *expr, | |
92 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
93 | void nft_range_eval(const struct nft_expr *expr, | |
94 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
95 | void nft_byteorder_eval(const struct nft_expr *expr, | |
96 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
97 | void nft_dynset_eval(const struct nft_expr *expr, | |
98 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
99 | void nft_rt_get_eval(const struct nft_expr *expr, | |
100 | struct nft_regs *regs, const struct nft_pktinfo *pkt); | |
96518518 | 101 | #endif /* _NET_NF_TABLES_CORE_H */ |