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: <8ef43d44ebdebe90783325cb68edb70a7c80c038.1663445339.git.sevinj.aghayeva@gmail.com>
Date:   Sat, 17 Sep 2022 16:18:00 -0400
From:   Sevinj Aghayeva <sevinj.aghayeva@...il.com>
To:     netdev@...r.kernel.org
Cc:     "David S. Miller" <davem@...emloft.net>, aroulin@...dia.com,
        sbrivio@...hat.com, roopa@...dia.com,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Nikolay Aleksandrov <razor@...ckwall.org>,
        linux-kernel@...r.kernel.org, bridge@...ts.linux-foundation.org,
        Sevinj Aghayeva <sevinj.aghayeva@...il.com>
Subject: [PATCH RFC net-next 4/5] net: bridge: handle link-type-specific changes in the bridge module

Introduce a handler to bridge module for handling vlan-specific
events.

Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@...il.com>
---
 net/bridge/br.c         |  5 +++++
 net/bridge/br_private.h |  7 +++++++
 net/bridge/br_vlan.c    | 18 ++++++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/net/bridge/br.c b/net/bridge/br.c
index 96e91d69a9a8..62e939c6a3f0 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -51,6 +51,11 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
 		}
 	}
 
+	if (is_vlan_dev(dev)) {
+		br_vlan_device_event(dev, event, ptr);
+		return NOTIFY_DONE;
+	}
+
 	/* not a port of a bridge */
 	p = br_port_get_rtnl(dev);
 	if (!p)
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 06e5f6faa431..a9a08e49c76c 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -1470,6 +1470,8 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v,
 void br_vlan_port_event(struct net_bridge_port *p, unsigned long event);
 int br_vlan_bridge_event(struct net_device *dev, unsigned long event,
 			 void *ptr);
+void br_vlan_device_event(struct net_device *dev, unsigned long event,
+ 			  void *ptr);
 void br_vlan_rtnl_init(void);
 void br_vlan_rtnl_uninit(void);
 void br_vlan_notify(const struct net_bridge *br,
@@ -1701,6 +1703,11 @@ static inline int br_vlan_bridge_event(struct net_device *dev,
 	return 0;
 }
 
+static void br_vlan_device_event(struct net_device *dev,
+				 unsigned long event, void *ptr)
+{
+}
+
 static inline void br_vlan_rtnl_init(void)
 {
 }
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 6e53dc991409..ba4e3c7a5f03 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
+#include <linux/notifier_info.h>
 #include <linux/rtnetlink.h>
 #include <linux/slab.h>
 #include <net/switchdev.h>
@@ -1768,6 +1769,23 @@ void br_vlan_port_event(struct net_bridge_port *p, unsigned long event)
 	}
 }
 
+void br_vlan_device_event(struct net_device *dev,
+			  unsigned long event, void *ptr)
+{
+	struct netdev_notifier_change_details_info *details;
+	struct net_device *br_dev;
+
+	switch (event) {
+	case NETDEV_CHANGE_DETAILS:
+		details = ptr;
+		if (!netif_is_bridge_master(vlan_dev_priv(dev)->real_dev))
+			break;
+		br_dev = vlan_dev_priv(dev)->real_dev;
+		br_vlan_upper_change(br_dev, dev, details->vlan.bridge_binding);
+		break;
+	}
+}
+
 static bool br_vlan_stats_fill(struct sk_buff *skb,
 			       const struct net_bridge_vlan *v)
 {
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ