netfilter: nf_tables: cancel register tracking if .reduce is not defined
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: nf_tables: cancel register tracking if .reduce is not defined
Cancel all register tracking if the the reduce function is not defined. Add missing reduce function to cmp since this is a read-only operation.
This unbreaks selftests/netfilter/nft_nat_zones.sh.
--- net/netfilter/nf_tables_api.c | 2 ++ net/netfilter/nft_cmp.c | 8 ++++++++ 2 files changed, 10 insertions(+)
net/netfilter/nf_tables_api.c +2 -0
@@ -8311,6 +8311,8 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha expr->ops->reduce(&track, expr)) { expr = track.cur;continue ; + } else if (expr->ops->reduce == NULL) { +memset (track.regs,0 ,sizeof (track.regs)); }if (WARN_ON_ONCE (data + expr->ops->size > data_boundary))
net/netfilter/nft_cmp.c +8 -0
@@ -187,12 +187,19 @@ static int nft_cmp_offload(struct nft_offload_ctx *ctx,return __nft_cmp_offload (ctx, flow, priv); } +static bool nft_cmp_reduce (struct nft_regs_track *track, +const struct nft_expr *expr) +{ +return false; +} +static const struct nft_expr_ops nft_cmp_ops = { .type = &nft_cmp_type, .size =NFT_EXPR_SIZE (sizeof (struct nft_cmp_expr )), .eval = nft_cmp_eval, .init = nft_cmp_init, .dump = nft_cmp_dump, + .reduce = nft_cmp_reduce, .offload = nft_cmp_offload, };
@@ -269,6 +276,7 @@ const struct nft_expr_ops nft_cmp_fast_ops = { .eval = NULL, /* inlined */ .init = nft_cmp_fast_init, .dump = nft_cmp_fast_dump, + .reduce = nft_cmp_reduce, .offload = nft_cmp_fast_offload, };
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerQuoted 9 lines · Pablo Neira Ayuso
Cancel all register tracking if the the reduce function is not defined. Add missing reduce function to cmp since this is a read-only operation.
This unbreaks
selftests/netfilter/nft_nat_zones.sh.Fixes 12e4ecfa244b ("netfilter: nf_tables: add register tracking infrastructure")Suggested-by Florian Westphal <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>---
Actually intended to nf-next.
Quoted 52 lines
net/netfilter/nf_tables_api.c | 2 ++ net/netfilter/nft_cmp.c | 8 ++++++++ 2 files changed, 10 insertions(+)net/netfilter/nf_tables_api.c +2
-0@@ -8311,6 +8311,8 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha expr->ops->reduce(&track, expr)) { expr = track.cur;continue ; + } else if (expr->ops->reduce == NULL) { +memset (track.regs,0 ,sizeof (track.regs)); }if (WARN_ON_ONCE (data + expr->ops->size > data_boundary))net/netfilter/nft_cmp.c +8
-0@@ -187,12 +187,19 @@ static int nft_cmp_offload(struct nft_offload_ctx *ctx,return __nft_cmp_offload (ctx, flow, priv); } +static bool nft_cmp_reduce (struct nft_regs_track *track, +const struct nft_expr *expr) +{ +return false; +} +static const struct nft_expr_ops nft_cmp_ops = { .type = &nft_cmp_type, .size =NFT_EXPR_SIZE (sizeof (struct nft_cmp_expr )), .eval = nft_cmp_eval, .init = nft_cmp_init, .dump = nft_cmp_dump, + .reduce = nft_cmp_reduce, .offload = nft_cmp_offload, };@@ -269,6 +276,7 @@ const struct nft_expr_ops nft_cmp_fast_ops = { .eval = NULL, /* inlined */ .init = nft_cmp_fast_init, .dump = nft_cmp_fast_dump, + .reduce = nft_cmp_reduce, .offload = nft_cmp_fast_offload, };Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerQuoted 4 lines · Pablo Neira Ayuso
Quoted 3 lines · Pablo Neira Ayuso
Cancel all register tracking if the the reduce function is not defined. Add missing reduce function to cmp since this is a read-only operation.
Quoted 8 lines
Quoted 6 lines
This unbreaks
selftests/netfilter/nft_nat_zones.sh.Fixes 12e4ecfa244b ("netfilter: nf_tables: add register tracking infrastructure")Suggested-by Florian Westphal <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>---
Actually intended to nf-next.
Oh, this is nf material indeed. Sorry for the confusion.