From 7837e62d164e41f869d85705304ed0af21f166b2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 21 Jan 2013 14:33:40 -0600 Subject: [PATCH] bond: set slave IFF_UP after releasing it The kernel bonding code calls "closes" (which clears IFF_UP) the slave and restores some of its attributes (MAC address, MTU, etc), but doesn't bring it back up. This breaks things like carrier detection, and indeed when the device is closed, its carrier is also cleared, which leads us to think the device is not available for activation. To ensure that further events are noticed by the device, and that its carrier state is accurately represented, make sure the device is still IFF_UP after it has been released. --- src/nm-device-bond.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/nm-device-bond.c b/src/nm-device-bond.c index bcb82fd4e9..96074beb4d 100644 --- a/src/nm-device-bond.c +++ b/src/nm-device-bond.c @@ -372,7 +372,7 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection) static gboolean release_slave (NMDevice *device, NMDevice *slave) { - gboolean success; + gboolean success, no_firmware = FALSE; success = nm_system_bond_release (nm_device_get_ip_ifindex (device), nm_device_get_ip_iface (device), @@ -383,6 +383,16 @@ release_slave (NMDevice *device, NMDevice *slave) nm_device_get_ip_iface (slave), success); g_object_notify (G_OBJECT (device), "slaves"); + + /* Kernel bonding code "closes" the slave when releasing it, (which clears + * IFF_UP), so we must bring it back up here to ensure carrier changes and + * other state is noticed by the now-released slave. + */ + if (!nm_device_hw_bring_up (slave, TRUE, &no_firmware)) { + nm_log_warn (LOGD_BOND, "(%s): released bond slave could not be brought up.", + nm_device_get_iface (slave)); + } + return success; }