xref: /openbmc/linux/include/net/netfilter/nft_meta.h (revision 7d34aa3e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _NFT_META_H_
3 #define _NFT_META_H_
4 
5 #include <net/netfilter/nf_tables.h>
6 
7 struct nft_meta {
8 	enum nft_meta_keys	key:8;
9 	u8			len;
10 	union {
11 		u8		dreg;
12 		u8		sreg;
13 	};
14 };
15 
16 extern const struct nla_policy nft_meta_policy[];
17 
18 int nft_meta_get_init(const struct nft_ctx *ctx,
19 		      const struct nft_expr *expr,
20 		      const struct nlattr * const tb[]);
21 
22 int nft_meta_set_init(const struct nft_ctx *ctx,
23 		      const struct nft_expr *expr,
24 		      const struct nlattr * const tb[]);
25 
26 int nft_meta_get_dump(struct sk_buff *skb,
27 		      const struct nft_expr *expr, bool reset);
28 
29 int nft_meta_set_dump(struct sk_buff *skb,
30 		      const struct nft_expr *expr, bool reset);
31 
32 void nft_meta_get_eval(const struct nft_expr *expr,
33 		       struct nft_regs *regs,
34 		       const struct nft_pktinfo *pkt);
35 
36 void nft_meta_set_eval(const struct nft_expr *expr,
37 		       struct nft_regs *regs,
38 		       const struct nft_pktinfo *pkt);
39 
40 void nft_meta_set_destroy(const struct nft_ctx *ctx,
41 			  const struct nft_expr *expr);
42 
43 int nft_meta_set_validate(const struct nft_ctx *ctx,
44 			  const struct nft_expr *expr,
45 			  const struct nft_data **data);
46 
47 bool nft_meta_get_reduce(struct nft_regs_track *track,
48 			 const struct nft_expr *expr);
49 
50 struct nft_inner_tun_ctx;
51 void nft_meta_inner_eval(const struct nft_expr *expr,
52 			 struct nft_regs *regs, const struct nft_pktinfo *pkt,
53 			 struct nft_inner_tun_ctx *tun_ctx);
54 
55 #endif
56