On Fri, Aug 21, 2015 at 11:48:10AM +0200, Natanael Copa wrote: > 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 <[email protected]>
Acked-by: Stéphane Graber <[email protected]> > --- > 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 > > _______________________________________________ > lxc-devel mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-devel -- Stéphane Graber Ubuntu developer http://www.ubuntu.com
signature.asc
Description: Digital signature
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
