diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-08-28 09:48:03 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-08-28 09:48:03 +0200 |
commit | b9d2017fe6a6b3ba54d55b1c4afc3fd870b6debc (patch) | |
tree | 1e5154fa16a13a85a86c6a2a63589f5238e4865e /main/lxc/0001-Clone-bridge-interface-MTU-setting.patch | |
parent | af4a085513a49ab0eb30749c667e60bf7a2e6a98 (diff) | |
download | aports-b9d2017fe6a6b3ba54d55b1c4afc3fd870b6debc.tar.bz2 aports-b9d2017fe6a6b3ba54d55b1c4afc3fd870b6debc.tar.xz |
main/lxc: fix jumboframes in containers
Diffstat (limited to 'main/lxc/0001-Clone-bridge-interface-MTU-setting.patch')
-rw-r--r-- | main/lxc/0001-Clone-bridge-interface-MTU-setting.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/main/lxc/0001-Clone-bridge-interface-MTU-setting.patch b/main/lxc/0001-Clone-bridge-interface-MTU-setting.patch new file mode 100644 index 0000000000..7f18e4f293 --- /dev/null +++ b/main/lxc/0001-Clone-bridge-interface-MTU-setting.patch @@ -0,0 +1,66 @@ +From e54864d3632e3959bed6dd6b7e6d2cbd7eb8eec0 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Fri, 21 Aug 2015 11:48:10 +0200 +Subject: [PATCH] Clone bridge interface MTU setting +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Instead of require static mtu setting in config we simply clone the +existing MTU setting of the bridge interface. + +This fixes issue when bridge interface has bigger MTU (like 9000 for +jumbo frame support) than the default 1500. When veth interface is +created it has by default MTU set to 1500 and when this is added to the +bridge, the kernel wee reduce the MTU for the bridge to 1500. We solve +this by cloning the MTU value from bridge interface. + +This simplifies managing containers with bridge interface who supports +jumbo frames (mtu 9000) and makes it easier to move containers between +hosts with different MTU settings. + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +Acked-by: Stéphane Graber <stgraber@ubuntu.com> +--- + src/lxc/conf.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/src/lxc/conf.c b/src/lxc/conf.c +index 309ceea..a3d45ee 100644 +--- a/src/lxc/conf.c ++++ b/src/lxc/conf.c +@@ -2609,7 +2609,7 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd + { + char veth1buf[IFNAMSIZ], *veth1; + char veth2buf[IFNAMSIZ], *veth2; +- int err; ++ int err, mtu = 0; + + if (netdev->priv.veth_attr.pair) { + veth1 = netdev->priv.veth_attr.pair; +@@ -2655,12 +2655,18 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd + } + + if (netdev->mtu) { +- err = lxc_netdev_set_mtu(veth1, atoi(netdev->mtu)); ++ mtu = atoi(netdev->mtu); ++ } else if (netdev->link) { ++ mtu = netdev_get_mtu(if_nametoindex(netdev->link)); ++ } ++ ++ if (mtu) { ++ err = lxc_netdev_set_mtu(veth1, mtu); + if (!err) +- err = lxc_netdev_set_mtu(veth2, atoi(netdev->mtu)); ++ err = lxc_netdev_set_mtu(veth2, mtu); + if (err) { +- ERROR("failed to set mtu '%s' for veth pair (%s and %s): %s", +- netdev->mtu, veth1, veth2, strerror(-err)); ++ ERROR("failed to set mtu '%i' for veth pair (%s and %s): %s", ++ mtu, veth1, veth2, strerror(-err)); + goto out_delete; + } + } +-- +2.5.0 + |