[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <533DD390.6020103@gmail.com>
Date: Fri, 04 Apr 2014 01:33:04 +0400
From: "Ilya V. Matveychikov" <matvejchikov@...il.com>
To: netdev@...r.kernel.org
CC: i.matveychikov@...uritycode.ru
Subject: [RFC PATCH] 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).
Signed-off-by: Ilya V. Matveychikov <i.matveychikov@...uritycode.ru>
---
drivers/net/veth.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index c0e7c64..a975226 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -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)
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists