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.
This commit is contained in:
Lubomir Rintel 2015-02-25 15:21:48 +01:00
parent 4d6bf4eef3
commit 1bc202af02
2 changed files with 10 additions and 5 deletions

View file

@ -4079,6 +4079,14 @@ print_support_extended_ifa_flags (NMSettingIP6ConfigPrivacy use_tempaddr)
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
nm_device_ipv6_set_mtu (NMDevice *self, guint32 mtu)
{
@ -5928,6 +5936,8 @@ nm_device_set_ip4_config (NMDevice *self,
if (commit && new_config) {
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
* stop nm_platform_ip4_address_sync() to replace the device routes. */
success = nm_ip4_config_commit (new_config, ip_ifindex,

View file

@ -264,7 +264,6 @@ gboolean
nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_route_metric)
{
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
guint32 mtu = nm_ip4_config_get_mtu (config);
int i;
g_return_val_if_fail (ifindex > 0, FALSE);
@ -299,10 +298,6 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, guint32 default_ro
return FALSE;
}
/* MTU */
if (mtu && mtu != nm_platform_link_get_mtu (ifindex))
nm_platform_link_set_mtu (ifindex, mtu);
return TRUE;
}