1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NET_NF_TABLES_CORE_H
3 #define _NET_NF_TABLES_CORE_H
5 #include <net/netfilter/nf_tables.h>
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;
15 extern struct nft_expr_type nft_meta_type;
16 extern struct nft_expr_type nft_rt_type;
17 extern struct nft_expr_type nft_exthdr_type;
19 #ifdef CONFIG_NETWORK_SECMARK
20 extern struct nft_object_type nft_secmark_obj_type;
23 int nf_tables_core_module_init(void);
24 void nf_tables_core_module_exit(void);
26 struct nft_bitwise_fast_expr {
33 struct nft_cmp_fast_expr {
41 struct nft_cmp16_fast_expr {
49 struct nft_immediate_expr {
55 /* Calculate the mask for the nft_cmp_fast expression. On big endian the
56 * mask needs to include the *upper* bytes when interpreting that data as
57 * something smaller than the full u32, therefore a cpu_to_le32 is done.
59 static inline u32 nft_cmp_fast_mask(unsigned int len)
61 return cpu_to_le32(~0U >> (sizeof_field(struct nft_cmp_fast_expr,
62 data) * BITS_PER_BYTE - len));
65 extern const struct nft_expr_ops nft_cmp_fast_ops;
66 extern const struct nft_expr_ops nft_cmp16_fast_ops;
69 enum nft_payload_bases base:8;
75 struct nft_payload_set {
76 enum nft_payload_bases base:8;
85 extern const struct nft_expr_ops nft_payload_fast_ops;
87 extern const struct nft_expr_ops nft_bitwise_fast_ops;
89 extern struct static_key_false nft_counters_enabled;
90 extern struct static_key_false nft_trace_enabled;
92 extern const struct nft_set_type nft_set_rhash_type;
93 extern const struct nft_set_type nft_set_hash_type;
94 extern const struct nft_set_type nft_set_hash_fast_type;
95 extern const struct nft_set_type nft_set_rbtree_type;
96 extern const struct nft_set_type nft_set_bitmap_type;
97 extern const struct nft_set_type nft_set_pipapo_type;
98 extern const struct nft_set_type nft_set_pipapo_avx2_type;
103 void nft_meta_get_eval(const struct nft_expr *expr,
104 struct nft_regs *regs, const struct nft_pktinfo *pkt);
105 void nft_cmp_eval(const struct nft_expr *expr,
106 struct nft_regs *regs, const struct nft_pktinfo *pkt);
107 void nft_lookup_eval(const struct nft_expr *expr,
108 struct nft_regs *regs, const struct nft_pktinfo *pkt);
109 void nft_payload_eval(const struct nft_expr *expr,
110 struct nft_regs *regs, const struct nft_pktinfo *pkt);
111 void nft_immediate_eval(const struct nft_expr *expr,
112 struct nft_regs *regs, const struct nft_pktinfo *pkt);
113 void nft_bitwise_eval(const struct nft_expr *expr,
114 struct nft_regs *regs, const struct nft_pktinfo *pkt);
115 void nft_range_eval(const struct nft_expr *expr,
116 struct nft_regs *regs, const struct nft_pktinfo *pkt);
117 void nft_byteorder_eval(const struct nft_expr *expr,
118 struct nft_regs *regs, const struct nft_pktinfo *pkt);
119 void nft_dynset_eval(const struct nft_expr *expr,
120 struct nft_regs *regs, const struct nft_pktinfo *pkt);
121 void nft_rt_get_eval(const struct nft_expr *expr,
122 struct nft_regs *regs, const struct nft_pktinfo *pkt);
123 #endif /* _NET_NF_TABLES_CORE_H */