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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user