Skip to content

Commit 92b211a

Browse files
committed
netfilter: nftables: move nft_expr before nft_set
Move the nft_expr structure definition before nft_set. Expressions are used by rules and sets, remove unnecessary forward declarations. This comes as preparation to support for multiple expressions per set element. Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 8cfd9b0 commit 92b211a

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

include/net/netfilter/nf_tables.h

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,33 @@ struct nft_set_estimate {
305305
enum nft_set_class space;
306306
};
307307

308+
#define NFT_EXPR_MAXATTR 16
309+
#define NFT_EXPR_SIZE(size) (sizeof(struct nft_expr) + \
310+
ALIGN(size, __alignof__(struct nft_expr)))
311+
312+
/**
313+
* struct nft_expr - nf_tables expression
314+
*
315+
* @ops: expression ops
316+
* @data: expression private data
317+
*/
318+
struct nft_expr {
319+
const struct nft_expr_ops *ops;
320+
unsigned char data[]
321+
__attribute__((aligned(__alignof__(u64))));
322+
};
323+
324+
static inline void *nft_expr_priv(const struct nft_expr *expr)
325+
{
326+
return (void *)expr->data;
327+
}
328+
329+
int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src);
330+
void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
331+
int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
332+
const struct nft_expr *expr);
333+
308334
struct nft_set_ext;
309-
struct nft_expr;
310335

311336
/**
312337
* struct nft_set_ops - nf_tables set operations
@@ -797,7 +822,6 @@ struct nft_offload_ctx;
797822
* @validate: validate expression, called during loop detection
798823
* @data: extra data to attach to this expression operation
799824
*/
800-
struct nft_expr;
801825
struct nft_expr_ops {
802826
void (*eval)(const struct nft_expr *expr,
803827
struct nft_regs *regs,
@@ -833,32 +857,6 @@ struct nft_expr_ops {
833857
void *data;
834858
};
835859

836-
#define NFT_EXPR_MAXATTR 16
837-
#define NFT_EXPR_SIZE(size) (sizeof(struct nft_expr) + \
838-
ALIGN(size, __alignof__(struct nft_expr)))
839-
840-
/**
841-
* struct nft_expr - nf_tables expression
842-
*
843-
* @ops: expression ops
844-
* @data: expression private data
845-
*/
846-
struct nft_expr {
847-
const struct nft_expr_ops *ops;
848-
unsigned char data[]
849-
__attribute__((aligned(__alignof__(u64))));
850-
};
851-
852-
static inline void *nft_expr_priv(const struct nft_expr *expr)
853-
{
854-
return (void *)expr->data;
855-
}
856-
857-
int nft_expr_clone(struct nft_expr *dst, struct nft_expr *src);
858-
void nft_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr);
859-
int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
860-
const struct nft_expr *expr);
861-
862860
/**
863861
* struct nft_rule - nf_tables rule
864862
*

0 commit comments

Comments
 (0)