From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: lorenzo@kernel.org
Subject: [PATCH nf-next 2/4] netfilter: flowtable: consolidate flowtable device check
Date: Thu, 23 Jul 2026 19:49:50 +0200 [thread overview]
Message-ID: <20260723174952.329650-3-pablo@netfilter.org> (raw)
In-Reply-To: <20260723174952.329650-1-pablo@netfilter.org>
Check that device belongs to the flowtable right after the flowtable
discovery path. This is a preparation patch to obtain the dst entry
from the .fill_forward_path in tunnels.
No functional changes are intended.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_flow_table_path.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nf_flow_table_path.c b/net/netfilter/nf_flow_table_path.c
index 261bb44d08eb..8f04a4487897 100644
--- a/net/netfilter/nf_flow_table_path.c
+++ b/net/netfilter/nf_flow_table_path.c
@@ -90,9 +90,12 @@ struct nft_forward_info {
enum flow_offload_xmit_type xmit_type;
};
+static bool nft_flowtable_find_dev(const struct net_device *dev,
+ struct nft_flowtable *ft);
+
static int nft_dev_path_info(const struct net_device_path_stack *stack,
struct nft_forward_info *info,
- unsigned char *ha, struct nf_flowtable *flowtable)
+ unsigned char *ha, struct nft_flowtable *ft)
{
const struct net_device_path *path;
int i;
@@ -178,10 +181,13 @@ static int nft_dev_path_info(const struct net_device_path_stack *stack,
}
}
- if (nf_flowtable_hw_offload(flowtable) &&
+ if (nf_flowtable_hw_offload(&ft->data) &&
nft_is_valid_ether_device(info->dev))
info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT;
+ if (!nft_flowtable_find_dev(info->dev, ft))
+ return -1;
+
return 0;
}
@@ -253,10 +259,7 @@ static int nft_dev_forward_path(const struct nft_pktinfo *pkt,
int i;
if (nft_dev_fill_forward_path(dst, ct, dir, ha, &stack) < 0 ||
- nft_dev_path_info(&stack, &info, ha, &ft->data) < 0)
- return -ENOENT;
-
- if (!nft_flowtable_find_dev(info.dev, ft))
+ nft_dev_path_info(&stack, &info, ha, ft) < 0)
return -ENOENT;
route->tuple[!dir].in.ifindex = info.dev->ifindex;
--
2.47.3
next prev parent reply other threads:[~2026-07-23 17:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 17:49 [PATCH nf-next 0/4] flowtable: pass dst_entry from ipip tunnel Pablo Neira Ayuso
2026-07-23 17:49 ` [PATCH nf-next 1/4] netfilter: flowtable: consolidate net_device field in nft_forward_info struct Pablo Neira Ayuso
2026-07-25 10:20 ` Lorenzo Bianconi
2026-07-23 17:49 ` Pablo Neira Ayuso [this message]
2026-07-25 10:25 ` [PATCH nf-next 2/4] netfilter: flowtable: consolidate flowtable device check Lorenzo Bianconi
2026-07-23 17:49 ` [PATCH nf-next 3/4] net: pass dst via net_device_path in dev_fill_forward_path() Pablo Neira Ayuso
2026-07-25 10:56 ` Lorenzo Bianconi
2026-07-23 17:49 ` [PATCH nf-next 4/4] netfilter: flowtable: release tunnel route on error when building forward path Pablo Neira Ayuso
2026-07-25 11:05 ` Lorenzo Bianconi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723174952.329650-3-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=lorenzo@kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.