[lxc-devel] [lxc/master] network: Restore fixed MTU functionality

tomponline on Github lxc-bot at linuxcontainers.org
Wed Jan 15 09:43:33 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 527 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200115/6d5fc964/attachment.bin>
-------------- next part --------------
From e7a7daea3cab94b487f1cdbd094c7a4e68673dc7 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 15 Jan 2020 09:33:31 +0000
Subject: [PATCH] network: Restore fixed MTU functionality

If MTU setting is provided in network device config then always use it rather than inheriting from the link device.

Affected both bridge and router veth modes.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 src/lxc/network.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index c8f44dd807..327bd97bd9 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -302,8 +302,10 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
 	if (!veth2)
 		return -1;
 
-	if (netdev->mtu && lxc_safe_uint(netdev->mtu, &mtu)) {
-		return log_error_errno(-1, errno, "Failed to parse mtu");
+	/* if mtu is specified in config then use that, otherwise inherit from link device if provided. */
+	if (netdev->mtu) {
+		if (lxc_safe_uint(netdev->mtu, &mtu))
+			return log_error_errno(-1, errno, "Failed to parse mtu");
 	} else if (netdev->link[0] != '\0') {
 		int ifindex_mtu;
 


More information about the lxc-devel mailing list