mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Leon M. Busch-George" <leon@georgemail.de>
To: "Nikolay Aleksandrov" <razor@blackwall.org>,
	linux-kernel@vger.kernel.org
Cc: bridge@lists.linux.dev, "David S. Miller" <davem@davemloft.net>,
	Felix Fietkau <nbd@nbd.name>
Subject: [PATCH] net: bridge: switchdev: Don't drop packets between ports with no hwdom
Date: Sun, 20 Oct 2024 18:20:14 +0200	[thread overview]
Message-ID: <20241020162105.3217305-1-leon@georgemail.de> (raw)

From: "Leon M. Busch-George" <leon@georgemail.eu>

nbp_switchdev_allowed_egress uses hwdom to determine whether or not a
packet has already been forwarded to a hardware domain. For
net_bridge_ports that aren't set up to use forward offloading, hwdom is
set to 0. When both ingress and egress port have no hwdom,
'cb->src_hwdom != p->hwdom' indicates that the packet is already known in
the target domain - which it isn't - and the packet is wrongly dropped.

The error was found on a bridge containing a wifi device and a VLAN
tagging device (e.g. eth0.12). With VLAN filtering, this shouldn't happen.

This patch adds a check for p->hwdom != 0 before comparing hardware
domains to restore forwarding between ports with hwdom = 0.

fwd_hwdoms are only set for ports with offloading enabled, which also
implies a valid hwdom, so the check '!test_bit(p->hwdom, &cb->fwd_hwdoms)'
doesn't fail in this way (yet - fingers crossed..) and it is left in place.

Co-developed-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
---
 net/bridge/br_switchdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 7b41ee8740cb..29ff9af99276 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -67,7 +67,7 @@ bool nbp_switchdev_allowed_egress(const struct net_bridge_port *p,
 	struct br_input_skb_cb *cb = BR_INPUT_SKB_CB(skb);
 
 	return !test_bit(p->hwdom, &cb->fwd_hwdoms) &&
-		(!skb->offload_fwd_mark || cb->src_hwdom != p->hwdom);
+		(!skb->offload_fwd_mark || !p->hwdom || cb->src_hwdom != p->hwdom);
 }
 
 /* Flags that can be offloaded to hardware */
-- 
2.47.0


                 reply	other threads:[~2024-10-20 16:28 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=20241020162105.3217305-1-leon@georgemail.de \
    --to=leon@georgemail.de \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=razor@blackwall.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

all inboxes | Powered by JetHome®