Message ID | 20240229000135.8780-2-pablo@netfilter.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 7e0f122c65912740327e4c54472acaa5f85868cb |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,1/3] netfilter: nf_tables: allow NFPROTO_INET in nft_(match/target)_validate() | expand |
Hello: This series was applied to netdev/net.git (main) by Pablo Neira Ayuso <pablo@netfilter.org>: On Thu, 29 Feb 2024 01:01:33 +0100 you wrote: > From: Ignat Korchagin <ignat@cloudflare.com> > > Commit d0009effa886 ("netfilter: nf_tables: validate NFPROTO_* family") added > some validation of NFPROTO_* families in the nft_compat module, but it broke > the ability to use legacy iptables modules in dual-stack nftables. > > While with legacy iptables one had to independently manage IPv4 and IPv6 > tables, with nftables it is possible to have dual-stack tables sharing the > rules. Moreover, it was possible to use rules based on legacy iptables > match/target modules in dual-stack nftables. > > [...] Here is the summary with links: - [net,1/3] netfilter: nf_tables: allow NFPROTO_INET in nft_(match/target)_validate() https://git.kernel.org/netdev/net/c/7e0f122c6591 - [net,2/3] netfilter: bridge: confirm multicast packets before passing them up the stack https://git.kernel.org/netdev/net/c/62e7151ae3eb - [net,3/3] selftests: netfilter: add bridge conntrack + multicast test case https://git.kernel.org/netdev/net/c/6523cf516c55 You are awesome, thank you!
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 1f9474fefe84..d3d11dede545 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c @@ -359,10 +359,20 @@ static int nft_target_validate(const struct nft_ctx *ctx, if (ctx->family != NFPROTO_IPV4 && ctx->family != NFPROTO_IPV6 && + ctx->family != NFPROTO_INET && ctx->family != NFPROTO_BRIDGE && ctx->family != NFPROTO_ARP) return -EOPNOTSUPP; + ret = nft_chain_validate_hooks(ctx->chain, + (1 << NF_INET_PRE_ROUTING) | + (1 << NF_INET_LOCAL_IN) | + (1 << NF_INET_FORWARD) | + (1 << NF_INET_LOCAL_OUT) | + (1 << NF_INET_POST_ROUTING)); + if (ret) + return ret; + if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain); @@ -610,10 +620,20 @@ static int nft_match_validate(const struct nft_ctx *ctx, if (ctx->family != NFPROTO_IPV4 && ctx->family != NFPROTO_IPV6 && + ctx->family != NFPROTO_INET && ctx->family != NFPROTO_BRIDGE && ctx->family != NFPROTO_ARP) return -EOPNOTSUPP; + ret = nft_chain_validate_hooks(ctx->chain, + (1 << NF_INET_PRE_ROUTING) | + (1 << NF_INET_LOCAL_IN) | + (1 << NF_INET_FORWARD) | + (1 << NF_INET_LOCAL_OUT) | + (1 << NF_INET_POST_ROUTING)); + if (ret) + return ret; + if (nft_is_base_chain(ctx->chain)) { const struct nft_base_chain *basechain = nft_base_chain(ctx->chain);