From 7651c77b78c09252e15cb9c4f7ab879326eda85e Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 18 Jan 2013 14:34:40 -0600 Subject: [PATCH] core: update hardware address when slaves change The hardware address of a device often changes when slaves change, for example with bond interfaces, which take the hardware address of their first slave. Make sure that's always up-to-date. --- src/nm-device.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/nm-device.c b/src/nm-device.c index 4a5061cdd0..e8e2333494 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -850,6 +850,13 @@ nm_device_enslave_slave (NMDevice *dev, NMDevice *slave, NMConnection *connectio info->enslaved = TRUE; nm_device_slave_notify_enslaved (info->slave, TRUE, FALSE); } + + /* Ensure the device's hardware address is up-to-date; it often changes + * when slaves change. + */ + if (NM_DEVICE_GET_CLASS (dev)->update_hw_address) + NM_DEVICE_GET_CLASS (dev)->update_hw_address (dev); + return success; } @@ -887,6 +894,13 @@ nm_device_release_one_slave (NMDevice *dev, NMDevice *slave, gboolean failed) priv->slaves = g_slist_remove (priv->slaves, info); free_slave_info (info); + + /* Ensure the device's hardware address is up-to-date; it often changes + * when slaves change. + */ + if (NM_DEVICE_GET_CLASS (dev)->update_hw_address) + NM_DEVICE_GET_CLASS (dev)->update_hw_address (dev); + return success; }