diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2014-09-08 16:20:58 +0200 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2014-11-24 10:33:21 +0100 |
commit | 4e105c5012667d5722d69e2a697ab085e62c7e0f (patch) | |
tree | 4d326f427067b3f1bf09515a991450649eeb9fda /src/devices | |
parent | fa325dca5a32557857695954fded74e7d57e11ae (diff) | |
download | NetworkManager-4e105c5012667d5722d69e2a697ab085e62c7e0f.tar.gz |
core: add NM_UNMANAGED_PARENT flag for a dependency on parent device
VLAN device depends on its parent, for instance. If the parent is not managed,
then the VLAN can't be either.
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/nm-device-vlan.c | 19 | ||||
-rw-r--r-- | src/devices/nm-device.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index d5f123c48a..a245a434b2 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -408,16 +408,7 @@ parent_state_changed (NMDevice *parent, if (reason == NM_DEVICE_STATE_REASON_CARRIER) return; - if (new_state < NM_DEVICE_STATE_DISCONNECTED) { - /* If the parent becomes unavailable or unmanaged so does the VLAN */ - nm_device_state_changed (NM_DEVICE (self), new_state, reason); - } else if ( new_state == NM_DEVICE_STATE_DISCONNECTED - && old_state < NM_DEVICE_STATE_DISCONNECTED) { - /* Mark VLAN interface as available/disconnected when the parent - * becomes available as a result of becoming initialized. - */ - nm_device_state_changed (NM_DEVICE (self), new_state, reason); - } + nm_device_set_unmanaged (NM_DEVICE (self), NM_UNMANAGED_PARENT, !nm_device_get_managed (parent), reason); } /******************************************************************/ @@ -639,6 +630,10 @@ new_link (NMDeviceFactory *factory, NMPlatformLink *plink, GError **error) device = NULL; } + /* Set initial parent-dependent unmanaged flag */ + if (device) + nm_device_set_initial_unmanaged_flag (device, NM_UNMANAGED_PARENT, !nm_device_get_managed (parent)); + return device; } @@ -690,6 +685,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory, device = NULL; } + /* Set initial parent-dependent unmanaged flag */ + if (device) + nm_device_set_initial_unmanaged_flag (device, NM_UNMANAGED_PARENT, !nm_device_get_managed (parent)); + return device; } diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index 9d0ff78179..ab54262623 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -301,12 +301,14 @@ RfKillType nm_device_get_rfkill_type (NMDevice *device); * @NM_UNMANAGED_INTERNAL: %TRUE when unmanaged by internal decision (ie, * because NM is sleeping or not managed for some other reason) * @NM_UNMANAGED_USER: %TRUE when unmanaged by user decision (via unmanaged-specs) + * @NM_UNMANAGED_PARENT: %TRUE when unmanaged due to parent device being unmanaged */ typedef enum { NM_UNMANAGED_NONE = 0x00, NM_UNMANAGED_DEFAULT = 0x01, NM_UNMANAGED_INTERNAL = 0x02, NM_UNMANAGED_USER = 0x04, + NM_UNMANAGED_PARENT = 0x08, /* Boundary value */ __NM_UNMANAGED_LAST, |