netfilter: nft_compat: run checkentry() from .validate
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v2 1/1 netfilter: nft_compat: run checkentry() from .validate
Several matches and one target check that the hook is correct from checkentry(), however, the basechain is only available from nft_table_validate().
This patch calls checkentry() for matches and targets from the nft_compat expression .validate path for the following matches/target:
- addrtype
- devgroup
- physdev
- policy
- set
- TCPMSS
- SET
The .destroy indirection is also called to restore the xt_set refcounts that is performed by .checkentry. The remaining extensions provide no .destroy interface.
This patch sets the table in the nft_ctx struct in nft_table_validate() which is required by this patch.
The nft_compat_check_match() and nft_compat_check_target() helper functions are added to wrap common code used from .init and .validate path.
The protocol and inverse flags are set to always match from the expression .validate path, this is already checked from the init path.
---
v2: add SET target. Posting to the ML until it is decided where to go with this.
net/netfilter/nf_tables_api.c | 1 + net/netfilter/nft_compat.c | 152 +++++++++++++++++++++++++++------- 2 files changed, 125 insertions(+), 28 deletions(-)
net/netfilter/nf_tables_api.c +1 -0
@@ -4205,6 +4205,7 @@ static int nft_table_validate(struct net *net, const struct nft_table *table)struct nft_chain *chain;struct nft_ctx ctx = { .net = net, + .table = (struct nft_table *)table, .family = table->family, };int err =0 ;
net/netfilter/nft_compat.c +124 -28
236 lines not on this page · raw message
Signature · 1 line
2.47.3