From: "Ilya V. Matveychikov" <matvejchikov@gmail.com>
To: netdev@vger.kernel.org
Cc: i.matveychikov@securitycode.ru
Subject: [RFC PATCH] veth: keep peers MTU values synchronized
Date: Fri, 04 Apr 2014 01:33:04 +0400 [thread overview]
Message-ID: <533DD390.6020103@gmail.com> (raw)
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@securitycode.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
next reply other threads:[~2014-04-03 21:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-03 21:33 Ilya V. Matveychikov [this message]
2014-04-04 14:25 ` [RFC PATCH] veth: keep peers MTU values synchronized David Miller
2014-04-04 14:42 ` Ilya V. Matveychikov
2014-04-04 14:49 ` David Miller
2014-04-04 15:04 ` Ilya V. Matveychikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=533DD390.6020103@gmail.com \
--to=matvejchikov@gmail.com \
--cc=i.matveychikov@securitycode.ru \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).