|
|
329b9a |
From 29fb28ca6cf192442886b11c85a8581e2e5c3518 Mon Sep 17 00:00:00 2001
|
|
|
329b9a |
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
|
329b9a |
Date: Mon, 10 Apr 2017 18:19:18 +0200
|
|
|
329b9a |
Subject: [PATCH] vlan: use parent interface mtu as default
|
|
|
329b9a |
|
|
|
329b9a |
VLANs already inherit the MTU from parent device when manually
|
|
|
329b9a |
activated. At boot, since the vlan interface is created before
|
|
|
329b9a |
activating the parent, the MTU is left to the default value.
|
|
|
329b9a |
|
|
|
329b9a |
Fix this by inheriting the MTU from parent when activating the
|
|
|
329b9a |
VLAN. Note that this change is effective only when the connection has
|
|
|
329b9a |
an actual IPv4 configuration; for all other cases users should
|
|
|
329b9a |
explicitly set the desired MTU value in the 'ethernet.mtu' property.
|
|
|
329b9a |
|
|
|
329b9a |
See master commit 7dde8d810604 ("vlan: use parent interface mtu as default")
|
|
|
329b9a |
|
|
|
329b9a |
https://bugzilla.redhat.com/show_bug.cgi?id=1439166
|
|
|
329b9a |
(cherry picked from commit 1c06d66a056b6a31e01ad3c91a15e80f3ba79078)
|
|
|
329b9a |
---
|
|
|
329b9a |
src/devices/nm-device-vlan.c | 18 ++++++++++++++----
|
|
|
329b9a |
1 file changed, 14 insertions(+), 4 deletions(-)
|
|
|
329b9a |
|
|
|
329b9a |
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
|
|
|
329b9a |
index 461bae6..b053fcc 100644
|
|
|
329b9a |
--- a/src/devices/nm-device-vlan.c
|
|
|
329b9a |
+++ b/src/devices/nm-device-vlan.c
|
|
|
329b9a |
@@ -598,19 +598,29 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
|
|
329b9a |
static void
|
|
|
329b9a |
ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
|
|
329b9a |
{
|
|
|
329b9a |
+ NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device);
|
|
|
329b9a |
NMConnection *connection;
|
|
|
329b9a |
NMSettingWired *s_wired;
|
|
|
329b9a |
- guint32 mtu;
|
|
|
329b9a |
+ guint32 mtu = 0;
|
|
|
329b9a |
+ int ifindex;
|
|
|
329b9a |
|
|
|
329b9a |
connection = nm_device_get_applied_connection (device);
|
|
|
329b9a |
g_assert (connection);
|
|
|
329b9a |
|
|
|
329b9a |
s_wired = nm_connection_get_setting_wired (connection);
|
|
|
329b9a |
- if (s_wired) {
|
|
|
329b9a |
+ if (s_wired)
|
|
|
329b9a |
mtu = nm_setting_wired_get_mtu (s_wired);
|
|
|
329b9a |
- if (mtu)
|
|
|
329b9a |
- nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
|
|
|
329b9a |
+
|
|
|
329b9a |
+ if (!mtu && priv->parent) {
|
|
|
329b9a |
+ /* Inherit the MTU from parent device, if any */
|
|
|
329b9a |
+ ifindex = nm_device_get_ifindex (priv->parent);
|
|
|
329b9a |
+ if (ifindex > 0)
|
|
|
329b9a |
+ mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET, ifindex);
|
|
|
329b9a |
}
|
|
|
329b9a |
+
|
|
|
329b9a |
+ if (mtu)
|
|
|
329b9a |
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
|
|
|
329b9a |
+
|
|
|
329b9a |
}
|
|
|
329b9a |
|
|
|
329b9a |
/******************************************************************/
|
|
|
329b9a |
--
|
|
|
329b9a |
2.7.4
|
|
|
329b9a |
|