summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2023-03-06 18:11:38 +0100
committerFernando Fernandez Mancera <ffmancera@riseup.net>2023-03-06 18:11:58 +0100
commitfd82ab268590c73ce05dfc47dcb7e4181afab257 (patch)
tree482d8dc8da88e58ee690f258a3f16dd6c49d3a8f
parent747d1100f51a7d89e11c88a7735a416430b5dbe6 (diff)
downloadNetworkManager-ff/find_device_unreal.tar.gz
manager: unrealized devices are not valid parentsff/find_device_unreal
When looking for a valid parent device we shouldn't consider unrealized devices. Usually create_and_realize() that requires parent device try to fetch the ifindex which they won't have so it will fail.
-rw-r--r--src/core/nm-manager.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index 5e83a0c53e..577f18bbfe 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -2355,11 +2355,12 @@ find_parent_device_for_connection(NMManager *self,
* with some known device.
*/
c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) {
- /* For a realized device, check that it's managed; otherwise it's not
- * compatible with any connection. If the device is unrealized then
- * the managed state is meaningless.
- */
- if (nm_device_is_real(candidate) && !nm_device_get_managed(candidate, FALSE))
+ /* An unrealized parent device is not a valid one. */
+ if (!nm_device_is_real(candidate))
+ continue;
+
+ /* Check that it's managed; otherwise it's not compatible with any connection. */
+ if (!nm_device_get_managed(candidate, FALSE))
continue;
if (nm_device_get_settings_connection(candidate) == parent_connection)