summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-01-06 19:09:46 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-01-14 18:44:20 +0100
commita169a79a7df1dbb8d966937c9cb887ffc6a63695 (patch)
tree61f60d4046a993e009e0a3f51fc0a7faf1276619
parent29eb46b126f111a68ae811aa69603f47b3a90c7a (diff)
downloadNetworkManager-lr/bond-mtu-rh1177582.tar.gz
bond: allow overriding the MTUlr/bond-mtu-rh1177582
Set the MTU if 802-3-ethernet.mtu is present and non-zero. The ifcfg-rh writer sets it if there's a MTU key. https://bugzilla.redhat.com/show_bug.cgi?id=1177582
-rw-r--r--src/devices/nm-device-bond.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
index 9d9fe426b2..07f5d0bff7 100644
--- a/src/devices/nm-device-bond.c
+++ b/src/devices/nm-device-bond.c
@@ -37,6 +37,7 @@
#include "nm-enum-types.h"
#include "nm-device-factory.h"
#include "nm-core-internal.h"
+#include "nm-ip4-config.h"
#include "nm-device-bond-glue.h"
@@ -376,6 +377,25 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
return ret;
}
+static void
+ip4_config_pre_commit (NMDevice *self, NMIP4Config *config)
+{
+ NMConnection *connection;
+ NMSettingWired *s_wired;
+ guint32 mtu;
+
+ connection = nm_device_get_connection (self);
+ g_assert (connection);
+ s_wired = nm_connection_get_setting_wired (connection);
+
+ if (s_wired) {
+ /* MTU override */
+ mtu = nm_setting_wired_get_mtu (s_wired);
+ if (mtu)
+ nm_ip4_config_set_mtu (config, mtu, NM_IP_CONFIG_SOURCE_USER);
+ }
+}
+
static gboolean
enslave_slave (NMDevice *device,
NMDevice *slave,
@@ -509,6 +529,7 @@ nm_device_bond_class_init (NMDeviceBondClass *klass)
parent_class->master_update_slave_connection = master_update_slave_connection;
parent_class->act_stage1_prepare = act_stage1_prepare;
+ parent_class->ip4_config_pre_commit = ip4_config_pre_commit;
parent_class->enslave_slave = enslave_slave;
parent_class->release_slave = release_slave;