mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 03:10:06 +01:00
nm-device: move device MTU setting from IP4Config to NMDevice
Just a refactoring, no functional change. This will make it easier to coordinate the device MTU with IPv6 MTU. (cherry picked from commit 86696e17fd205de91e36998d524584335163d32b)
This commit is contained in:
parent
777482aa82
commit
9b79e6c732
2 changed files with 10 additions and 5 deletions
|
|
@ -4032,6 +4032,14 @@ print_support_extended_ifa_flags (NMSettingIP6ConfigPrivacy use_tempaddr)
|
||||||
warn = 2;
|
warn = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nm_device_set_mtu (NMDevice *self, guint32 mtu)
|
||||||
|
{
|
||||||
|
/* MTU */
|
||||||
|
if (mtu && mtu != nm_platform_link_get_mtu (ifindex))
|
||||||
|
nm_platform_link_set_mtu (ifindex, mtu);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nm_device_ipv6_set_mtu (NMDevice *self, guint32 mtu)
|
nm_device_ipv6_set_mtu (NMDevice *self, guint32 mtu)
|
||||||
{
|
{
|
||||||
|
|
@ -5895,6 +5903,8 @@ nm_device_set_ip4_config (NMDevice *self,
|
||||||
if (commit && new_config) {
|
if (commit && new_config) {
|
||||||
gboolean assumed = nm_device_uses_assumed_connection (self);
|
gboolean assumed = nm_device_uses_assumed_connection (self);
|
||||||
|
|
||||||
|
nm_device_set_mtu (self, nm_ip4_config_get_mtu (new_config));
|
||||||
|
|
||||||
/* for assumed devices we set the device_route_metric to the default which will
|
/* for assumed devices we set the device_route_metric to the default which will
|
||||||
* stop nm_platform_ip4_address_sync() to replace the device routes. */
|
* stop nm_platform_ip4_address_sync() to replace the device routes. */
|
||||||
success = nm_ip4_config_commit (new_config, ip_ifindex,
|
success = nm_ip4_config_commit (new_config, ip_ifindex,
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,6 @@ gboolean
|
||||||
nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric)
|
nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric)
|
||||||
{
|
{
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||||
guint32 mtu = nm_ip4_config_get_mtu (config);
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, FALSE);
|
g_return_val_if_fail (ifindex > 0, FALSE);
|
||||||
|
|
@ -289,10 +288,6 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_ro
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MTU */
|
|
||||||
if (mtu && mtu != nm_platform_link_get_mtu (ifindex))
|
|
||||||
nm_platform_link_set_mtu (ifindex, mtu);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue