Skip to content

Commit c6ae970

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sja1105: fix checks for VLAN state in redirect action
This action requires the VLAN awareness state of the switch to be of the same type as the key that's being added: - If the switch is unaware of VLAN, then the tc filter key must only contain the destination MAC address. - If the switch is VLAN-aware, the key must also contain the VLAN ID and PCP. But this check doesn't work unless we verify the VLAN awareness state on both the "if" and the "else" branches. Fixes: dfacc5a ("net: dsa: sja1105: support flow-based redirection via virtual links") Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5b3b396 commit c6ae970

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/dsa/sja1105/sja1105_vl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,9 @@ int sja1105_vl_redirect(struct sja1105_private *priv, int port,
342342
NL_SET_ERR_MSG_MOD(extack,
343343
"Can only redirect based on DMAC");
344344
return -EOPNOTSUPP;
345-
} else if (key->type != SJA1105_KEY_VLAN_AWARE_VL) {
345+
} else if ((priv->vlan_state == SJA1105_VLAN_BEST_EFFORT ||
346+
priv->vlan_state == SJA1105_VLAN_FILTERING_FULL) &&
347+
key->type != SJA1105_KEY_VLAN_AWARE_VL) {
346348
NL_SET_ERR_MSG_MOD(extack,
347349
"Can only redirect based on {DMAC, VID, PCP}");
348350
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)