diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-02-25 15:21:48 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-03-09 18:21:01 +0100 |
commit | 1bc202af028ad8987a92500bba6bb36156d8be5f (patch) | |
tree | 638079e910ef0ebff24c44503064baba1fa94add | |
parent | 4d6bf4eef31b19779ad1d7df1687785e349f4807 (diff) | |
download | NetworkManager-1bc202af028ad8987a92500bba6bb36156d8be5f.tar.gz |
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.
-rw-r--r-- | src/devices/nm-device.c | 10 | ||||
-rw-r--r-- | src/nm-ip4-config.c | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index e3e64787f8..808ba6f0b1 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4080,6 +4080,14 @@ print_support_extended_ifa_flags (NMSettingIP6ConfigPrivacy use_tempaddr) } 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) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); @@ -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, diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 1f3e5954b3..10e2b62c62 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -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; } |