merge: branch 'bg/autoconnect-ports-ovs'

Fix autoconnect-ports for OVS interfaces

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2131
This commit is contained in:
Beniamino Galvani
2025-02-12 08:54:02 +00:00

View File

@@ -4536,7 +4536,7 @@ nm_manager_get_best_device_for_connection(NMManager *self,
NMSettingsConnection *sett_conn, NMSettingsConnection *sett_conn,
NMConnection *connection, NMConnection *connection,
gboolean for_user_request, gboolean for_user_request,
GHashTable *unavailable_devices, GHashTable *exclude_devices,
GError **error) GError **error)
{ {
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self);
@@ -4619,7 +4619,7 @@ nm_manager_get_best_device_for_connection(NMManager *self,
ac_device = nm_active_connection_get_device(ac); ac_device = nm_active_connection_get_device(ac);
if (ac_device if (ac_device
&& ((unavailable_devices && g_hash_table_contains(unavailable_devices, ac_device)) && (nm_g_hash_table_contains(exclude_devices, ac_device)
|| !nm_device_check_connection_available(ac_device, connection, flags, NULL, NULL))) || !nm_device_check_connection_available(ac_device, connection, flags, NULL, NULL)))
ac_device = NULL; ac_device = NULL;
@@ -4635,9 +4635,7 @@ nm_manager_get_best_device_for_connection(NMManager *self,
NMDevice *ac_device2 = nm_active_connection_get_device(ac2); NMDevice *ac_device2 = nm_active_connection_get_device(ac2);
NMActiveConnectionState ac_state2; NMActiveConnectionState ac_state2;
if (!ac_device2 if (!ac_device2 || nm_g_hash_table_contains(exclude_devices, ac_device2)
|| (unavailable_devices
&& g_hash_table_contains(unavailable_devices, ac_device2))
|| !nm_device_check_connection_available(ac_device2, || !nm_device_check_connection_available(ac_device2,
connection, connection,
flags, flags,
@@ -4698,7 +4696,13 @@ found_better:
GError *local = NULL; GError *local = NULL;
DeviceActivationPrio prio; DeviceActivationPrio prio;
if (unavailable_devices && g_hash_table_contains(unavailable_devices, device)) if (nm_g_hash_table_contains(exclude_devices, device))
continue;
if (!nm_device_is_available(device,
for_user_request
? NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST
: NM_DEVICE_CHECK_DEV_AVAILABLE_NONE))
continue; continue;
/* determine the priority of this device. Currently, this priority is independent /* determine the priority of this device. Currently, this priority is independent