diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 711ac2acb0..21e653df43 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2958,15 +2958,18 @@ nm_device_complete_connection (NMDevice *self, static gboolean check_connection_compatible (NMDevice *self, NMConnection *connection) { - NMSettingConnection *s_con; - const char *config_iface, *device_iface; + const char *device_iface = nm_device_get_iface (self); + gs_free char *conn_iface = nm_manager_get_connection_iface (nm_manager_get (), + connection, + NULL, NULL); - s_con = nm_connection_get_setting_connection (connection); - g_assert (s_con); + /* We always need a interface name for virtual devices, but for + * physical ones a connection without interface name is fine for + * any device. */ + if (!conn_iface) + return !nm_connection_is_virtual (connection); - config_iface = nm_setting_connection_get_interface_name (s_con); - device_iface = nm_device_get_iface (self); - if (config_iface && strcmp (config_iface, device_iface) != 0) + if (strcmp (conn_iface, device_iface) != 0) return FALSE; return TRUE; diff --git a/src/nm-manager.c b/src/nm-manager.c index eb9576eeeb..dce5d3c80c 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1033,9 +1033,7 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) for (iter = priv->devices; iter; iter = g_slist_next (iter)) { NMDevice *candidate = iter->data; - if ( g_strcmp0 (nm_device_get_iface (candidate), iface) == 0 - && nm_device_check_connection_compatible (candidate, connection)) { - + if (nm_device_check_connection_compatible (candidate, connection)) { if (nm_device_is_real (candidate)) { nm_log_dbg (LOGD_DEVICE, "(%s) already created virtual interface name %s", nm_connection_get_id (connection), iface);