lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 24 Jul 2023 12:10:59 +0200
From: Daniel Mack <daniel.mack@...oplot.com>
To: netdev@...r.kernel.org
Cc: andrew@...n.ch,
	f.fainelli@...il.com,
	olteanv@...il.com,
	Daniel Mack <daniel.mack@...oplot.com>
Subject: [PATCH] net: dsa: mv88e6xxx: use distinct FIDs for each bridge

Allow setups with overlapping VLAN IDs in different bridges by settting
the FID of all bridge ports to the index of the bridge.

Read the FID back when detecting overlaps.

Signed-off-by: Daniel Mack <daniel.mack@...oplot.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index c7d51a539451..dff271981c69 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2028,6 +2028,7 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
 	struct mv88e6xxx_chip *chip = ds->priv;
 	struct mv88e6xxx_vtu_entry vlan;
 	int err;
+	u16 fid;
 
 	/* DSA and CPU ports have to be members of multiple vlans */
 	if (dsa_port_is_dsa(dp) || dsa_port_is_cpu(dp))
@@ -2037,11 +2038,16 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
 	if (err)
 		return err;
 
+	err = mv88e6xxx_port_get_fid(chip, port, &fid);
+	if (err)
+		return err;
+
 	if (!vlan.valid)
 		return 0;
 
 	dsa_switch_for_each_user_port(other_dp, ds) {
 		struct net_device *other_br;
+		u16 other_fid;
 
 		if (vlan.member[other_dp->index] ==
 		    MV88E6XXX_G1_VTU_DATA_MEMBER_TAG_NON_MEMBER)
@@ -2054,6 +2060,10 @@ static int mv88e6xxx_port_check_hw_vlan(struct dsa_switch *ds, int port,
 		if (!other_br)
 			continue;
 
+		err = mv88e6xxx_port_get_fid(chip, other_dp->index, &other_fid);
+		if (err == 0 && fid != other_fid)
+			continue;
+
 		dev_err(ds->dev, "p%d: hw VLAN %d already used by port %d in %s\n",
 			port, vlan.vid, other_dp->index, netdev_name(other_br));
 		return -EOPNOTSUPP;
@@ -2948,6 +2958,11 @@ static int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
 		*tx_fwd_offload = true;
 	}
 
+	/* Set the port's FID to the bridge index so bridges can have
+	 * overlapping VLANs.
+	 */
+	err = mv88e6xxx_port_set_fid(chip, port, bridge.num);
+
 unlock:
 	mv88e6xxx_reg_unlock(chip);
 
-- 
2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ