Skip to contentSkip to conversation

veth: keep peers MTU values synchronized

RFC PATCH In review Ilya V. Matveychikov 3 participants 5 messages Apr 3, 2014 – Apr 4, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 veth: keep peers MTU values synchronized

Keep peers MTU values synchronized. That prevent dropping packets while
forwarding as diffirent MTU values prevent skb moving from one peer's device to another (is_skb_forwardable returns false).

---
 drivers/net/veth.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/veth.c +15 -1
index c0e7c64..a975226 100644
@@ -227,10 +227,24 @@ static int is_valid_veth_mtu(int new_mtu)
 
 static int veth_change_mtu(struct net_device *dev, int new_mtu)
 {
+	int err, old_mtu;
+	struct veth_priv *priv = netdev_priv(dev);
+	struct net_device *peer = rtnl_dereference(priv->peer);
+
+	if (!peer)
+		return -ENOTCONN;
+
 	if (!is_valid_veth_mtu(new_mtu))
 		return -EINVAL;
+
+	old_mtu = dev->mtu;
 	dev->mtu = new_mtu;
-	return 0;
+
+	err = dev_set_mtu(peer, new_mtu);
+	if (err)
+		dev->mtu = old_mtu;
+
+	return err;
 }
 
 static int veth_dev_init(struct net_device *dev)
Signature · 1 line
1.8.1.2
maintainer
#1 lore raw

From: "Ilya V. Matveychikov" <[email protected]>
Date: Fri, 04 Apr 2014 01:33:04 +0400

Quoted 6 lines

Keep peers MTU values synchronized. That prevent dropping packets while
forwarding as diffirent MTU values prevent skb moving from one peer's device to another (is_skb_forwardable returns false).

Such side effects on another device when changing the configuration of one are strongly discouraged.

Furthermore, when the veth peer is created, no attempt is made to synchronize the MTUs.

Let it therefore be the admins responsibility to keep them in sync just as it would be on a real network.

#2 lore raw
Quoted 8 lines · David Miller

From: "Ilya V. Matveychikov" <[email protected]>
Date: Fri, 04 Apr 2014 01:33:04 +0400

Quoted 5 lines

Keep peers MTU values synchronized. That prevent dropping packets while
forwarding as diffirent MTU values prevent skb moving from one peer's device to another (is_skb_forwardable returns false).

Quoted 5 lines
Quoted 1 line

Such side effects on another device when changing the configuration of one are strongly discouraged.

Devices are paired. It means that one depends on another. Is there any case where this "side" effect wouldn't be helpful?

Quoted 2 lines

Furthermore, when the veth peer is created, no attempt is made to synchronize the MTUs.

Peers are created at once and ether_setup used for the configuration so MTU values equals.

Quoted 5 lines

Let it therefore be the admins responsibility to keep them in sync just as it would be on a real network.

Different MTU values for the veth pairs are meaningless as if so we can't do the communication between the namespaces at all. So, is it correct to shift all the configuration problems to admins?

maintainer
#3 lore raw

From: "Ilya V. Matveychikov" <[email protected]>
Date: Fri, 4 Apr 2014 18:42:29 +0400

Quoted 2 lines

Peers are created at once and ether_setup used for the configuration so MTU values equals.

If an IFLA_MTU value is specified for the peer it will be honored.

#4 lore raw
Quoted 9 lines · David Miller

From: "Ilya V. Matveychikov" <[email protected]>
Date: Fri, 4 Apr 2014 18:42:29 +0400

Quoted 2 lines

Peers are created at once and ether_setup used for the configuration so MTU values equals.

If an IFLA_MTU value is specified for the peer it will be honored.

OK, I see it. Does that mean that the patch needs to be updated or the proposed behavior is incorrect and must not be in kernel?