Commit a00fbab5 by Thomas Parrott

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: 's avatarThomas Parrott <thomas.parrott@canonical.com>
parent e0f80435
...@@ -273,7 +273,7 @@ static int lxc_is_ip_forwarding_enabled(const char *ifname, int family) ...@@ -273,7 +273,7 @@ static int lxc_is_ip_forwarding_enabled(const char *ifname, int family)
static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netdev) static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netdev)
{ {
int err; int err;
unsigned int mtu; unsigned int mtu = 1500;
char *veth1, *veth2; char *veth1, *veth2;
char veth1buf[IFNAMSIZ], veth2buf[IFNAMSIZ]; char veth1buf[IFNAMSIZ], veth2buf[IFNAMSIZ];
...@@ -302,8 +302,10 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd ...@@ -302,8 +302,10 @@ static int instantiate_veth(struct lxc_handler *handler, struct lxc_netdev *netd
if (!veth2) if (!veth2)
return -1; return -1;
if (netdev->mtu && lxc_safe_uint(netdev->mtu, &mtu)) { /* if mtu is specified in config then use that, otherwise inherit from link device if provided. */
return log_error_errno(-1, errno, "Failed to parse mtu"); 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') { } else if (netdev->link[0] != '\0') {
int ifindex_mtu; int ifindex_mtu;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment