Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: hauke@hauke-m.de
Subject: [PATCH nf,v2] net: update dev_fill_forward_path() to handle mac80211 special case
Date: Mon, 14 Sep 2026 14:33:34 +0200	[thread overview]
Message-ID: <20260914123334.1964397-1-pablo@netfilter.org> (raw)

Before commit b5964aac51e0 ("netfilter: flowtable: consolidate xmit
path"), there was a fallback to create a bypass in case
.ndo_fill_forward_path fails.

Commit d787a3e38f01 ("mac80211: add support for .ndo_fill_forward_path")
relies on such fallback, so most mac80211 drivers used to work since
they do not provide a net_fill_forward_path interface.

Add a special case to dev_fill_forward_path() by returning 1 in case
.ndo_fill_forward_path is implemented but this is expected to be the
last device in the forward path stack.

Fixes: b5964aac51e0 ("netfilter: flowtable: consolidate xmit path")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
v2: do not incremental stack->num_path, use the existing empty slot.

 net/core/dev.c       | 4 +++-
 net/mac80211/iface.c | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index ecfbd72d5d1a..53140edfd1b4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -787,6 +787,8 @@ int dev_fill_forward_path(struct net_device_path_ctx *ctx,
 		ret = ctx->dev->netdev_ops->ndo_fill_forward_path(ctx, path);
 		if (ret < 0)
 			goto err_out;
+		else if (ret > 0)
+			goto out;
 
 		stack->num_paths++;
 		if (WARN_ON_ONCE(last_dev == ctx->dev))
@@ -795,7 +797,7 @@ int dev_fill_forward_path(struct net_device_path_ctx *ctx,
 
 	if (!ctx->dev)
 		return ret;
-
+out:
 	path = dev_fwd_path(stack);
 	if (!path)
 		goto err_out;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 43460a705a6b..8c0cc2b4c6ed 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -998,7 +998,7 @@ static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
 	local = sdata->local;
 
 	if (!local->ops->net_fill_forward_path)
-		return -EOPNOTSUPP;
+		return 1;
 
 	rcu_read_lock();
 	switch (sdata->vif.type) {
-- 
2.47.3


                 reply	other threads:[~2026-09-14 12:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260914123334.1964397-1-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=hauke@hauke-m.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox