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]
Date:   Wed, 27 May 2020 14:25:09 -0700
From:   Edwin Peer <edwin.peer@...adcom.com>
To:     netdev@...r.kernel.org
Cc:     Edwin Peer <edwin.peer@...adcom.com>, edumazet@...gle.com,
        linville@...driver.com, shemminger@...tta.com,
        mirq-linux@...e.qmqm.pl, jesse.brandeburg@...el.com,
        jchapman@...alix.com, david@...ve.works, j.vosburgh@...il.com,
        vfalico@...il.com, andy@...yhouse.net, sridhar.samudrala@...el.com,
        jiri@...lanox.com, geoff@...radead.org, mokuno@...sony.co.jp,
        msink@...monline.ru, mporter@...nel.crashing.org,
        inaky.perez-gonzalez@...el.com, jwi@...ux.ibm.com,
        kgraul@...ux.ibm.com, ubraun@...ux.ibm.com,
        grant.likely@...retlab.ca, hadi@...erus.ca, dsahern@...nel.org,
        shrijeet@...il.com, jon.mason@...el.com, dave.jiang@...el.com,
        saeedm@...lanox.com, hadarh@...lanox.com, ogerlitz@...lanox.com,
        allenbh@...il.com, michael.chan@...adcom.com
Subject: [RFC PATCH net-next 08/11] net: distribute IFF_NO_VLAN_ROOM into aggregate devs

VLANs layered above aggregate devices such as bonds and teams should
inherit the MTU limitations of the devices underlying the aggregate.
If any one of the slave devices is constrained by IFF_NO_VLAN_ROOM,
then so must the aggregate as a whole.

Signed-off-by: Edwin Peer <edwin.peer@...adcom.com>
---
 drivers/net/bonding/bond_main.c |  3 +++
 drivers/net/net_failover.c      | 12 ++++++++++++
 drivers/net/team/team.c         |  5 +++++
 3 files changed, 20 insertions(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4c45f1692934..3002ba879d14 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1147,6 +1147,7 @@ static void bond_compute_features(struct bonding *bond)
 	vlan_features &= NETIF_F_ALL_FOR_ALL;
 	mpls_features &= NETIF_F_ALL_FOR_ALL;
 	bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE;
+	bond_dev->priv_flags &= ~IFF_NO_VLAN_ROOM;
 
 	bond_for_each_slave(bond, slave, iter) {
 		vlan_features = netdev_increment_features(vlan_features,
@@ -1162,6 +1163,8 @@ static void bond_compute_features(struct bonding *bond)
 
 		bond_dev->priv_flags &= slave->dev->priv_flags |
 					~IFF_XMIT_DST_RELEASE;
+		bond_dev->priv_flags |= slave->dev->priv_flags &
+					IFF_NO_VLAN_ROOM;
 
 		if (slave->dev->hard_header_len > max_hard_header_len)
 			max_hard_header_len = slave->dev->hard_header_len;
diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
index 436945e0a4c1..a085d292b4cf 100644
--- a/drivers/net/net_failover.c
+++ b/drivers/net/net_failover.c
@@ -211,6 +211,16 @@ static void net_failover_get_stats(struct net_device *dev,
 	spin_unlock(&nfo_info->stats_lock);
 }
 
+static void net_failover_constrain_vlan(struct net_device *dev,
+					struct net_device *primary,
+					struct net_device *standby)
+{
+	dev->priv_flags &= ~IFF_NO_VLAN_ROOM;
+	dev->priv_flags |= IFF_NO_VLAN_ROOM &
+			   ((primary ? primary->priv_flags : 0) |
+			    (standby ? standby->priv_flags : 0));
+}
+
 static int net_failover_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct net_failover_info *nfo_info = netdev_priv(dev);
@@ -235,6 +245,7 @@ static int net_failover_change_mtu(struct net_device *dev, int new_mtu)
 	}
 
 	dev->mtu = new_mtu;
+	net_failover_constrain_vlan(dev, primary_dev, standby_dev);
 
 	return 0;
 }
@@ -427,6 +438,7 @@ static void net_failover_compute_features(struct net_device *dev)
 	dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL;
 	dev->hard_header_len = max_hard_header_len;
 
+	net_failover_constrain_vlan(dev, primary_dev, standby_dev);
 
 	netdev_change_features(dev);
 }
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 5987fc2db031..3e18d1de036d 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -990,6 +990,7 @@ static void __team_compute_features(struct team *team)
 	unsigned short max_hard_header_len = ETH_HLEN;
 
 	team->dev->priv_flags |= IFF_XMIT_DST_RELEASE;
+	team->dev->priv_flags &= ~IFF_NO_VLAN_ROOM;
 
 	list_for_each_entry(port, &team->port_list, list) {
 		vlan_features = netdev_increment_features(vlan_features,
@@ -1002,6 +1003,8 @@ static void __team_compute_features(struct team *team)
 
 		team->dev->priv_flags &= port->dev->priv_flags |
 					 ~IFF_XMIT_DST_RELEASE;
+		team->dev->priv_flags |= port->dev->priv_flags &
+					 IFF_NO_VLAN_ROOM;
 
 		if (port->dev->hard_header_len > max_hard_header_len)
 			max_hard_header_len = port->dev->hard_header_len;
@@ -1808,6 +1811,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)
 	 */
 	mutex_lock(&team->lock);
 	team->port_mtu_change_allowed = true;
+	dev->priv_flags &= ~IFF_NO_VLAN_ROOM;
 	list_for_each_entry(port, &team->port_list, list) {
 		err = dev_set_mtu(port->dev, new_mtu);
 		if (err) {
@@ -1815,6 +1819,7 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)
 				   port->dev->name);
 			goto unwind;
 		}
+		dev->priv_flags |= port->dev->priv_flags & IFF_NO_VLAN_ROOM;
 	}
 	team->port_mtu_change_allowed = false;
 	mutex_unlock(&team->lock);
-- 
2.26.2

Powered by blists - more mailing lists