Skip to contentSkip to conversation

net: dsa: tag_brcm: fix link-local detection with a prepended tag

PATCH New Florian Fainelli 2 participants 2 messages Nov 18

Subsystems (4)
lore
Share & tools
lore

Florian Fainelli

author maintainer
#0 lore raw

PATCH 1/1 net: dsa: tag_brcm: fix link-local detection with a prepended tag

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")

---
This change was a result of a Sashiko review on this patch series:
https://lore.kernel.org/all/[email protected]/

 net/dsa/tag_brcm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
net/dsa/tag_brcm.c +6 -1
index b7c49822ca88..b58669c92147 100644
@@ -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;
Signature · 1 line
2.53.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.