diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2014-11-16 16:07:22 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2014-11-20 14:43:17 +0100 |
commit | c83b40aca76fc0ed624a6c9e71dbd7b0abfa13f2 (patch) | |
tree | 678722de857817a7b467156f2a2bf53660160cab /src/devices | |
parent | e2f489ebdab976cb60c2ae2c8d7d7592c4e47176 (diff) | |
download | NetworkManager-c83b40aca76fc0ed624a6c9e71dbd7b0abfa13f2.tar.gz |
device: Remove unmanaged slaves from master when they disappear
We've previously been just watching for state changes into UNMANAGED state. No
state change is emitted upon removal of a device which is already unmanaged.
https://bugzilla.gnome.org/show_bug.cgi?id=737659
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/nm-device.c | 17 | ||||
-rw-r--r-- | src/devices/nm-device.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 2a3ef8da69..56ecfcaf4b 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1602,6 +1602,23 @@ nm_device_get_enslaved (NMDevice *self) return NM_DEVICE_GET_PRIVATE (self)->enslaved; } +/** + * nm_device_removed: + * @self: the #NMDevice + * + * Called by the manager when the device was removed. Releases the device from + * the master in case it's enslaved. + */ +void +nm_device_removed (NMDevice *self) +{ + NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + + if (priv->enslaved) + nm_device_release_one_slave (priv->master, self, TRUE, NM_DEVICE_STATE_REASON_REMOVED); +} + + static gboolean is_available (NMDevice *self) { diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 64687f7cbe..9d0ff78179 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -253,6 +253,8 @@ NMDevice * nm_device_get_master (NMDevice *dev); NMActRequest * nm_device_get_act_request (NMDevice *dev); NMConnection * nm_device_get_connection (NMDevice *dev); +void nm_device_removed (NMDevice *dev); + gboolean nm_device_is_available (NMDevice *dev); gboolean nm_device_has_carrier (NMDevice *dev); |