diff mbox series

[net-next] netfilter: nft_fib: allow from forward/input without iif selector

Message ID 20240517151137.89270-1-eric@garver.life (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next] netfilter: nft_fib: allow from forward/input without iif selector | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 920 this patch: 920
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 7 maintainers not CCed: netfilter-devel@vger.kernel.org pabeni@redhat.com dsahern@kernel.org kuba@kernel.org edumazet@google.com coreteam@netfilter.org kadlec@netfilter.org
netdev/build_clang success Errors and warnings before: 925 this patch: 925
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 925 this patch: 925
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-05-17--18-00 (tests: 1036)

Commit Message

Eric Garver May 17, 2024, 3:11 p.m. UTC
This removes the restriction of needing iif selector in the
forward/input hooks for fib lookups when requested result is
oif/oifname.

Removing this restriction allows "loose" lookups from the forward hooks.

Signed-off-by: Eric Garver <eric@garver.life>
---
 net/ipv4/netfilter/nft_fib_ipv4.c | 3 +--
 net/ipv6/netfilter/nft_fib_ipv6.c | 3 +--
 net/netfilter/nft_fib.c           | 8 +++-----
 3 files changed, 5 insertions(+), 9 deletions(-)

Comments

Eric Garver May 17, 2024, 3:37 p.m. UTC | #1
On Fri, May 17, 2024 at 11:11:37AM -0400, Eric Garver wrote:
> This removes the restriction of needing iif selector in the
> forward/input hooks for fib lookups when requested result is
> oif/oifname.
> 
> Removing this restriction allows "loose" lookups from the forward hooks.
> 
> Signed-off-by: Eric Garver <eric@garver.life>
> ---

I mistakenly sent this to the wrong list. Sorry. Please ignore.

I'll repost to netfilter-devel.
diff mbox series

Patch

diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c
index 9eee535c64dd..975a4a809058 100644
--- a/net/ipv4/netfilter/nft_fib_ipv4.c
+++ b/net/ipv4/netfilter/nft_fib_ipv4.c
@@ -116,8 +116,7 @@  void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
 		fl4.daddr = iph->daddr;
 		fl4.saddr = get_saddr(iph->saddr);
 	} else {
-		if (nft_hook(pkt) == NF_INET_FORWARD &&
-		    priv->flags & NFTA_FIB_F_IIF)
+		if (nft_hook(pkt) == NF_INET_FORWARD)
 			fl4.flowi4_iif = nft_out(pkt)->ifindex;
 
 		fl4.daddr = iph->saddr;
diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c
index 36dc14b34388..f95e39e235d3 100644
--- a/net/ipv6/netfilter/nft_fib_ipv6.c
+++ b/net/ipv6/netfilter/nft_fib_ipv6.c
@@ -30,8 +30,7 @@  static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,
 		fl6->daddr = iph->daddr;
 		fl6->saddr = iph->saddr;
 	} else {
-		if (nft_hook(pkt) == NF_INET_FORWARD &&
-		    priv->flags & NFTA_FIB_F_IIF)
+		if (nft_hook(pkt) == NF_INET_FORWARD)
 			fl6->flowi6_iif = nft_out(pkt)->ifindex;
 
 		fl6->daddr = iph->saddr;
diff --git a/net/netfilter/nft_fib.c b/net/netfilter/nft_fib.c
index 37cfe6dd712d..b58f62195ff3 100644
--- a/net/netfilter/nft_fib.c
+++ b/net/netfilter/nft_fib.c
@@ -35,11 +35,9 @@  int nft_fib_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
 	switch (priv->result) {
 	case NFT_FIB_RESULT_OIF:
 	case NFT_FIB_RESULT_OIFNAME:
-		hooks = (1 << NF_INET_PRE_ROUTING);
-		if (priv->flags & NFTA_FIB_F_IIF) {
-			hooks |= (1 << NF_INET_LOCAL_IN) |
-				 (1 << NF_INET_FORWARD);
-		}
+		hooks = (1 << NF_INET_PRE_ROUTING) |
+			(1 << NF_INET_LOCAL_IN) |
+			(1 << NF_INET_FORWARD);
 		break;
 	case NFT_FIB_RESULT_ADDRTYPE:
 		if (priv->flags & NFTA_FIB_F_IIF)