Skip to content

Commit a398b9e

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: tag_sja1105: fix source port decoding in vlan_filtering=0 bridge mode
There was a regression introduced by the blamed commit, where pinging to a VLAN-unaware bridge would fail with the repeated message "Couldn't decode source port" coming from the tagging protocol driver. When receiving packets with a bridge_vid as determined by dsa_tag_8021q_bridge_join(), dsa_8021q_rcv() will decode: - source_port = 0 (which isn't really valid, more like "don't know") - switch_id = 0 (which isn't really valid, more like "don't know") - vbid = value in range 1-7 Since the blamed patch has reversed the order of the checks, we are now going to believe that source_port != -1 and switch_id != -1, so they're valid, but they aren't. The minimal solution to the problem is to only populate source_port and switch_id with what dsa_8021q_rcv() came up with, if the vbid is zero, i.e. the source port information is trustworthy. Fixes: c1ae02d ("net: dsa: tag_sja1105: always prefer source port information from INCL_SRCPT") Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6ca3c00 commit a398b9e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

net/dsa/tag_sja1105.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,14 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
573573
* if available. This allows us to not overwrite a valid source
574574
* port and switch ID with zeroes when receiving link-local
575575
* frames from a VLAN-unaware bridged port (non-zero vbid) or a
576-
* VLAN-aware bridged port (non-zero vid).
576+
* VLAN-aware bridged port (non-zero vid). Furthermore, the
577+
* tag_8021q source port information is only of trust when the
578+
* vbid is 0 (precise port). Otherwise, tmp_source_port and
579+
* tmp_switch_id will be zeroes.
577580
*/
578-
if (source_port == -1)
581+
if (vbid == 0 && source_port == -1)
579582
source_port = tmp_source_port;
580-
if (switch_id == -1)
583+
if (vbid == 0 && switch_id == -1)
581584
switch_id = tmp_switch_id;
582585
} else if (source_port == -1 && switch_id == -1) {
583586
/* Packets with no source information have no chance of

0 commit comments

Comments
 (0)