[PATCH net] net: dsa: tag_brcm: fix link-local detection with a prepended tag
From: Florian Fainelli
Date: Wed Nov 18 2026 - 13:40:24 EST
brcm_tag_rcv_ll() checks eth_hdr(skb)->h_dest to avoid marking link-local
frames as forwarded by the switch. With a prepended tag, eth_type_trans()
sets the MAC header at the start of the tag, so the address checked is the
tag plus the first two bytes of the real destination address. Link-local
frames such as BPDUs, LLDP or EAPOL are then not recognized and get
skb->offload_fwd_mark set, which keeps the bridge from forwarding them in
software to the other ports of the switch when it is configured to do so.
Read the destination address after the tag instead when the tag is
prepended. Tags embedded after the source address are not affected.
Fixes: 762e7e174da9 ("net: dsa: tag_brcm: do not mark link local traffic as offloaded")
Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
This change was a result of a Sashiko review on this patch series:
https://lore.kernel.org/all/20261116222519.1416501-1-florian.fainelli@xxxxxxxxxxxx/
net/dsa/tag_brcm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index b7c49822ca88..b58669c92147 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -149,6 +149,7 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb,
unsigned int offset)
{
int source_port;
+ const u8 *dest;
u8 *brcm_tag;
if (unlikely(!pskb_may_pull(skb, BRCM_TAG_LEN))) {
@@ -184,7 +185,11 @@ static struct sk_buff *brcm_tag_rcv_ll(struct sk_buff *skb,
/* Remove Broadcom tag and update checksum */
skb_pull_rcsum(skb, BRCM_TAG_LEN);
- if (likely(!is_link_local_ether_addr(eth_hdr(skb)->h_dest)))
+ /* With a prepended tag, the MAC header set by eth_type_trans() starts
+ * at the tag, and the destination address follows it.
+ */
+ dest = offset == ETH_HLEN ? brcm_tag + BRCM_TAG_LEN : eth_hdr(skb)->h_dest;
+ if (likely(!is_link_local_ether_addr(dest)))
dsa_default_offload_fwd_mark(skb);
return skb;
--
2.53.0