mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
vlan: use parent interface mtu as default
After commit22e8af6242
("device: set a per-device default MTU on activation") we explicitly set the VLAN MTU to 1500 if not overridden by user settings. This has the advantage that the MTU is set to a predictable value, while before it could have different values depending on when the interface was created (for example, the interface would get a 1500 MTU if created during boot, or would inherit the parent's MTU if activated manually). However, a better default value is the MTU of the parent interface which is in most cases what the user wants. This value was the default before commit22e8af6242
for manually activated connections. https://bugzilla.redhat.com/show_bug.cgi?id=1414186
This commit is contained in:
parent
8134d72f49
commit
7dde8d8106
|
@ -572,6 +572,24 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static guint32
|
||||
get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
|
||||
{
|
||||
guint32 mtu = 0;
|
||||
int ifindex;
|
||||
|
||||
mtu = nm_device_get_configured_mtu_for_wired (self, out_is_user_config);
|
||||
if (*out_is_user_config)
|
||||
return mtu;
|
||||
|
||||
/* Inherit the MTU from parent device, if any */
|
||||
ifindex = nm_device_parent_get_ifindex (self);
|
||||
if (ifindex > 0)
|
||||
mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET, ifindex);
|
||||
|
||||
return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRED;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
|
@ -612,7 +630,7 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass)
|
|||
parent_class->unrealize_notify = unrealize_notify;
|
||||
parent_class->get_generic_capabilities = get_generic_capabilities;
|
||||
parent_class->act_stage1_prepare = act_stage1_prepare;
|
||||
parent_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
||||
parent_class->get_configured_mtu = get_configured_mtu;
|
||||
parent_class->is_available = is_available;
|
||||
parent_class->parent_changed_notify = parent_changed_notify;
|
||||
|
||||
|
|
Loading…
Reference in a new issue