mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 07:30:16 +01:00
device: apply MTU setting also to devices without IPv4 configuration
Usually the MTU in the ethernet.mtu property is applied to the device
during the commit of IPv4 configuration. For devices with
ipv4.method=disabled or slave devices that phase is skipped and so the
setting does not have effect. Apply the MTU explicitly in such cases.
https://bugzilla.redhat.com/show_bug.cgi?id=1303968
https://bugzilla.redhat.com/show_bug.cgi?id=1303731
(cherry picked from commit 53dfaddda2)
This commit is contained in:
parent
38ce17b8b9
commit
2959977164
1 changed files with 40 additions and 1 deletions
|
|
@ -416,6 +416,7 @@ static NMActStageReturn dhcp4_start (NMDevice *self, NMConnection *connection, N
|
|||
static gboolean dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason);
|
||||
static void nm_device_start_ip_check (NMDevice *self);
|
||||
static void realize_start_setup (NMDevice *self, const NMPlatformLink *plink);
|
||||
static void nm_device_set_mtu (NMDevice *self, guint32 mtu);
|
||||
|
||||
/***********************************************************/
|
||||
|
||||
|
|
@ -1094,6 +1095,38 @@ find_slave_info (NMDevice *self, NMDevice *slave)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_mtu_from_config (NMDevice *self)
|
||||
{
|
||||
const char *method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
NMSettingWired *s_wired;
|
||||
guint32 mtu;
|
||||
|
||||
/* Devices having an IPv4 configuration will set MTU during the commit
|
||||
* stage, so it is an error to call this function if the IPv4 method is not
|
||||
* 'disabled'.
|
||||
*/
|
||||
s_ip4 = (NMSettingIPConfig *)
|
||||
nm_device_get_applied_setting (self, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
if (s_ip4)
|
||||
method = nm_setting_ip_config_get_method (s_ip4);
|
||||
g_return_if_fail (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED));
|
||||
|
||||
s_wired = (NMSettingWired *)
|
||||
nm_device_get_applied_setting (self, NM_TYPE_SETTING_WIRED);
|
||||
|
||||
if (s_wired) {
|
||||
mtu = nm_setting_wired_get_mtu (s_wired);
|
||||
if (mtu) {
|
||||
_LOGD (LOGD_DEVICE | LOGD_IP,
|
||||
"setting MTU of device without IP4 config to %u",
|
||||
mtu);
|
||||
nm_device_set_mtu (self, mtu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_master_enslave_slave:
|
||||
* @self: the master device
|
||||
|
|
@ -1151,6 +1184,11 @@ nm_device_master_enslave_slave (NMDevice *self, NMDevice *slave, NMConnection *c
|
|||
nm_device_activate_stage3_ip6_start (self);
|
||||
}
|
||||
|
||||
/* Since slave devices don't have their own IP configuration,
|
||||
* set the MTU here.
|
||||
*/
|
||||
apply_mtu_from_config (slave);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
@ -4965,7 +5003,8 @@ act_stage3_ip4_config_start (NMDevice *self,
|
|||
} else
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0) {
|
||||
/* Nothing to do... */
|
||||
apply_mtu_from_config (self);
|
||||
/* Nothing else to do... */
|
||||
ret = NM_ACT_STAGE_RETURN_STOP;
|
||||
} else
|
||||
_LOGW (LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue