[lxc-devel] [lxc/master] Set up MTU for vlan-type interfaces.

vel21ripn on Github lxc-bot at linuxcontainers.org
Wed Jul 6 20:14:18 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160706/cf581b18/attachment.bin>
-------------- next part --------------
From 76f5b64eae59851c7ee4cd46d6e6a1b50faa3209 Mon Sep 17 00:00:00 2001
From: Vitaly Lavrov <vel21ripn at gmail.com>
Date: Thu, 30 Jun 2016 20:04:49 +0300
Subject: [PATCH] Set up MTU for vlan-type interfaces.

---
 src/lxc/conf.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index e8dfaae..d1f136e 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -2741,6 +2741,16 @@ static int instantiate_vlan(struct lxc_handler *handler, struct lxc_netdev *netd
 
 	DEBUG("instantiated vlan '%s', ifindex is '%d'", " vlan1000",
 	      netdev->ifindex);
+	if (netdev->mtu) {
+		int mtu = atoi(netdev->mtu);
+		err = mtu > 64 && mtu < 65536 ? lxc_netdev_set_mtu(peer,mtu) : EINVAL;
+		if(err) {
+			ERROR("failed to set mtu '%s' for %s : %s",
+			      netdev->mtu, peer, strerror(-err));
+			lxc_netdev_delete_by_name(peer);
+			return -1;
+		}
+	}
 
 	return 0;
 }


More information about the lxc-devel mailing list