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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220216132934.1775649-4-tobias@waldekranz.com>
Date:   Wed, 16 Feb 2022 14:29:28 +0100
From:   Tobias Waldekranz <tobias@...dekranz.com>
To:     davem@...emloft.net, kuba@...nel.org
Cc:     Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        Ivan Vecera <ivecera@...hat.com>,
        Roopa Prabhu <roopa@...dia.com>,
        Nikolay Aleksandrov <nikolay@...dia.com>,
        Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, bridge@...ts.linux-foundation.org
Subject: [RFC net-next 3/9] net: bridge: vlan: Notify switchdev drivers of VLAN MST migrations

Whenever a VLAN moves to a new MSTID, send a switchdev notification so
that switchdevs can track a bridge's VID to MSTID mapping.

Signed-off-by: Tobias Waldekranz <tobias@...dekranz.com>
---
 include/net/switchdev.h | 10 ++++++++++
 net/bridge/br_vlan.c    | 20 ++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index d353793dfeb5..ee4a7bd1e540 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -28,6 +28,7 @@ enum switchdev_attr_id {
 	SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
 	SWITCHDEV_ATTR_ID_BRIDGE_MROUTER,
 	SWITCHDEV_ATTR_ID_MRP_PORT_ROLE,
+	SWITCHDEV_ATTR_ID_VLAN_MSTID,
 };
 
 struct switchdev_brport_flags {
@@ -35,6 +36,14 @@ struct switchdev_brport_flags {
 	unsigned long mask;
 };
 
+struct switchdev_vlan_attr {
+	u16 vid;
+
+	union {
+		u16 mstid;
+	};
+};
+
 struct switchdev_attr {
 	struct net_device *orig_dev;
 	enum switchdev_attr_id id;
@@ -50,6 +59,7 @@ struct switchdev_attr {
 		u16 vlan_protocol;			/* BRIDGE_VLAN_PROTOCOL */
 		bool mc_disabled;			/* MC_DISABLED */
 		u8 mrp_port_role;			/* MRP_PORT_ROLE */
+		struct switchdev_vlan_attr vlan_attr;	/* VLAN_* */
 	} u;
 };
 
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 459e84a7354d..c45a34c14e10 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -173,6 +173,26 @@ static int br_vlan_mst_migrate(struct net_bridge_vlan *v, u16 mstid)
 	old_mst = rtnl_dereference(v->mst);
 	rcu_assign_pointer(v->mst, mst);
 
+	if (br_vlan_is_master(v)) {
+		struct switchdev_attr attr = {
+			.id = SWITCHDEV_ATTR_ID_VLAN_MSTID,
+			.flags = SWITCHDEV_F_DEFER,
+			.orig_dev = br->dev,
+			.u.vlan_attr = {
+				.vid = v->vid,
+				.mstid = mstid,
+			},
+		};
+		int err;
+
+		err = switchdev_port_attr_set(br->dev, &attr, NULL);
+		if (err && err != -EOPNOTSUPP) {
+			rcu_assign_pointer(v->mst, old_mst);
+			br_vlan_mst_put(mst);
+			return err;
+		}
+	}
+
 	if (old_mst)
 		br_vlan_mst_put(old_mst);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ