manager: relax check when creating virtual devices

For each connection that corresponds to a software device, we create a
"unrealized" device that then becomes realized just before the
connection starts activating. Currently, in certain conditions NM
creates two devices with the same name and type, one realized and one
not; this is not expected and can lead to other issues especially when
a software device is reactivated.

Avoid that by relaxing the check in system_create_virtual_device(): if
a device exists with the same name and type, we don't want to create
another even if the type-specific parameters differ.
This commit is contained in:
Beniamino Galvani
2023-01-24 14:46:17 +01:00
parent 99756757c8
commit 7b9a9352c2

View File

@@ -2549,7 +2549,7 @@ system_create_virtual_device(NMManager *self, NMConnection *connection)
/* See if there's a device that is already compatible with this connection */
c_list_for_each_entry (dev_candidate, &priv->devices_lst_head, devices_lst) {
if (nm_device_check_connection_compatible(dev_candidate, connection, TRUE, NULL)) {
if (nm_device_check_connection_compatible(dev_candidate, connection, FALSE, NULL)) {
if (nm_device_is_real(dev_candidate)) {
_LOG3D(LOGD_DEVICE, connection, "already created virtual interface name %s", iface);
return NULL;