device: explicitly handle unrealized devices in is_available()

Unrealized software devices are always available for activation,
hardware devices never.

In nm_manager_get_best_device_for_activation() we call
nm_device_is_available() on candidate devices. Without this fix, any
unrealized software device would be not considered ready for
activation, which is wrong.

A software device can override the default implementation of
is_available(). For example NMDeviceOvsInterface does that and only
checks the OVSDB is ready.

Fixes: ba86c208e0 ('Revert "core: prevent the activation of unavailable OVS interfaces only"')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2253
This commit is contained in:
Beniamino Galvani 2025-08-20 16:51:05 +02:00
parent 96be0cf049
commit 8b26cb35ee

View file

@ -9164,6 +9164,10 @@ is_available(NMDevice *self, NMDeviceCheckDevAvailableFlags flags)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
/* unrealized software devices are always available, hardware devices never */
if (!nm_device_is_real(self))
return nm_device_is_software(self);
if (priv->carrier || priv->ignore_carrier)
return TRUE;