core: virtual devices can be available without a parent set
When calling to nm_device_is_available, the device types that requires a parent like VLAN or MACVLAN checks that their parent exists. nm_device_is_available is a function to check if the device is available to activate a connection, so it makes sense that if the parent is not present it can't be activated. However, this is wrong for 2 reasons: 1. Most of they are virtual devices that might be unrealized when checking its availability. If they're unrealized, their parent hasn't been set yet. 2. Even if they're realized, their current parent might not be the one that is defined in the connection that is being activated. This is causing that unrealized devices are not being activated as ports because nm_manager_get_best_device_for_connection thinks that they are not available. Get rid of these checks for the parent in the is_available callbacks. Fixes:ba86c208e0
('Revert "core: prevent the activation of unavailable OVS interfaces only"') Fixes:774badb151
('core: prevent the activation of unavailable devices')
This commit is contained in:

committed by
Íñigo Huguet

parent
34255b2692
commit
94595332c4
@@ -137,14 +137,6 @@ link_changed(NMDevice *device, const NMPlatformLink *pllink)
|
||||
nm_device_parent_set_ifindex(device, parent);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||
{
|
||||
if (!nm_device_parent_get_device(device))
|
||||
return FALSE;
|
||||
return NM_DEVICE_CLASS(nm_device_6lowpan_parent_class)->is_available(device, flags);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
complete_connection(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
@@ -237,7 +229,6 @@ nm_device_6lowpan_class_init(NMDevice6LowpanClass *klass)
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->get_configured_mtu = nm_device_get_configured_mtu_for_wired;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->is_available = is_available;
|
||||
device_class->parent_changed_notify = parent_changed_notify;
|
||||
device_class->update_connection = update_connection;
|
||||
}
|
||||
|
@@ -221,16 +221,6 @@ get_generic_capabilities(NMDevice *device)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||
{
|
||||
if (!nm_device_parent_get_device(device))
|
||||
return FALSE;
|
||||
return NM_DEVICE_CLASS(nm_device_ipvlan_parent_class)->is_available(device, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
@@ -376,7 +366,6 @@ nm_device_ipvlan_class_init(NMDeviceIpvlanClass *klass)
|
||||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
device_class->create_and_realize = create_and_realize;
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->is_available = is_available;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->update_connection = update_connection;
|
||||
|
||||
|
@@ -683,14 +683,6 @@ get_generic_capabilities(NMDevice *dev)
|
||||
|
||||
/******************************************************************/
|
||||
|
||||
static gboolean
|
||||
is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||
{
|
||||
if (!nm_device_parent_get_device(device))
|
||||
return FALSE;
|
||||
return NM_DEVICE_CLASS(nm_device_macsec_parent_class)->is_available(device, flags);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
create_and_realize(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
@@ -903,7 +895,6 @@ nm_device_macsec_class_init(NMDeviceMacsecClass *klass)
|
||||
device_class->deactivate = deactivate;
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->is_available = is_available;
|
||||
device_class->parent_changed_notify = parent_changed_notify;
|
||||
device_class->state_changed = device_state_changed;
|
||||
device_class->get_configured_mtu = nm_device_get_configured_mtu_wired_parent;
|
||||
|
@@ -270,16 +270,6 @@ get_generic_capabilities(NMDevice *device)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||
{
|
||||
if (!nm_device_parent_get_device(device))
|
||||
return FALSE;
|
||||
return NM_DEVICE_CLASS(nm_device_macvlan_parent_class)->is_available(device, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
@@ -508,7 +498,6 @@ nm_device_macvlan_class_init(NMDeviceMacvlanClass *klass)
|
||||
device_class->create_and_realize = create_and_realize;
|
||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||
device_class->get_configured_mtu = nm_device_get_configured_mtu_wired_parent;
|
||||
device_class->is_available = is_available;
|
||||
device_class->link_changed = link_changed;
|
||||
device_class->parent_changed_notify = parent_changed_notify;
|
||||
device_class->update_connection = update_connection;
|
||||
|
@@ -292,16 +292,6 @@ get_generic_capabilities(NMDevice *device)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
||||
{
|
||||
if (!nm_device_parent_get_device(device))
|
||||
return FALSE;
|
||||
return NM_DEVICE_CLASS(nm_device_vlan_parent_class)->is_available(device, flags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
check_connection_compatible(NMDevice *device,
|
||||
NMConnection *connection,
|
||||
@@ -561,7 +551,6 @@ nm_device_vlan_class_init(NMDeviceVlanClass *klass)
|
||||
device_class->act_stage1_prepare_set_hwaddr_ethernet = TRUE;
|
||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||
device_class->get_configured_mtu = nm_device_get_configured_mtu_wired_parent;
|
||||
device_class->is_available = is_available;
|
||||
device_class->parent_changed_notify = parent_changed_notify;
|
||||
|
||||
device_class->check_connection_compatible = check_connection_compatible;
|
||||
|
Reference in New Issue
Block a user