summaryrefslogtreecommitdiff
path: root/cloudinit/net/sysconfig.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2018-06-12 09:23:08 -0600
committerChad Smith <chad.smith@canonical.com>2018-06-12 09:23:08 -0600
commitc3f1ad9abd4a28c1b4c1f34db28ac72a646cdca6 (patch)
tree556acefac4e3726b28fb3859a8799926a3352403 /cloudinit/net/sysconfig.py
parentfc23ccc91307c81dd8e428465eb56efbd539267e (diff)
downloadvyos-cloud-init-c3f1ad9abd4a28c1b4c1f34db28ac72a646cdca6.tar.gz
vyos-cloud-init-c3f1ad9abd4a28c1b4c1f34db28ac72a646cdca6.zip
netplan: fix mtu if provided by network config for all rendered types
When network configuration for any interface defines maximum transmission values (MTU) the netplan, eni and sysconfig renders will take into account any device-level, or subnet-level mtu values. When network configuration has conflicting device-level and ipv4 subnet mtu values, the subnet-specific value is honored and a warning will be logged about any ignored device-level setting. LP: #1774666
Diffstat (limited to 'cloudinit/net/sysconfig.py')
-rw-r--r--cloudinit/net/sysconfig.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index e53b9f1b..3d719238 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -304,6 +304,13 @@ class Renderer(renderer.Renderer):
mtu_key = 'IPV6_MTU'
iface_cfg['IPV6INIT'] = True
if 'mtu' in subnet:
+ mtu_mismatch = bool(mtu_key in iface_cfg and
+ subnet['mtu'] != iface_cfg[mtu_key])
+ if mtu_mismatch:
+ LOG.warning(
+ 'Network config: ignoring %s device-level mtu:%s'
+ ' because ipv4 subnet-level mtu:%s provided.',
+ iface_cfg.name, iface_cfg[mtu_key], subnet['mtu'])
iface_cfg[mtu_key] = subnet['mtu']
elif subnet_type == 'manual':
# If the subnet has an MTU setting, then ONBOOT=True