From 84ef2acdd00b3173dcb5af8edd41e8b60c569b41 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 29 Feb 2012 12:39:57 -0600 Subject: [PATCH] bond: set bond device options during activation --- src/nm-device-bond.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/nm-device-bond.c b/src/nm-device-bond.c index 2a293ded84..710de4cb74 100644 --- a/src/nm-device-bond.c +++ b/src/nm-device-bond.c @@ -293,6 +293,34 @@ connection_match_config (NMDevice *self, const GSList *connections) /******************************************************************/ +static NMActStageReturn +real_act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason) +{ + NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; + NMConnection *connection; + NMSettingBond *s_bond; + gboolean no_firmware = FALSE; + + g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE); + + ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage1_prepare (dev, reason); + if (ret == NM_ACT_STAGE_RETURN_SUCCESS) { + connection = nm_device_get_connection (dev); + g_assert (connection); + s_bond = nm_connection_get_setting_bond (connection); + g_assert (s_bond); + + /* Interface must be down to set bond options */ + nm_device_hw_take_down (dev, TRUE); + + if (!nm_system_apply_bonding_config (nm_device_get_ip_iface (dev), s_bond)) + ret = NM_ACT_STAGE_RETURN_FAILURE; + + nm_device_hw_bring_up (dev, TRUE, &no_firmware); + } + return ret; +} + static void slave_state_changed (NMDevice *slave, NMDeviceState new_state, @@ -512,6 +540,7 @@ nm_device_bond_class_init (NMDeviceBondClass *klass) parent_class->spec_match_list = spec_match_list; parent_class->connection_match_config = connection_match_config; + parent_class->act_stage1_prepare = real_act_stage1_prepare; parent_class->enslave_slave = enslave_slave; parent_class->release_slave = release_slave;