diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c index b2c9050a7a..ddf798dfc1 100644 --- a/src/devices/nm-device-factory.c +++ b/src/devices/nm-device-factory.c @@ -162,14 +162,8 @@ get_connection_iface (NMDeviceFactory *factory, NMConnection *connection, const char *parent_iface) { - const char *iface; - - /* For any other virtual connection, NMSettingConnection:interface-name is - * the virtual device name. - */ - iface = nm_connection_get_interface_name (connection); - g_return_val_if_fail (iface != NULL, NULL); - return g_strdup (iface); + /* Default to just using NMSettingConnection:interface-name */ + return g_strdup (nm_connection_get_interface_name (connection)); } char * @@ -184,20 +178,11 @@ nm_device_factory_get_connection_iface (NMDeviceFactory *factory, g_return_val_if_fail (connection != NULL, NULL); g_return_val_if_fail (!error || !*error, NULL); - if (!nm_connection_is_virtual (connection)) { - g_set_error (error, - NM_MANAGER_ERROR, - NM_MANAGER_ERROR_FAILED, - "failed to determine virtual interface name: connection type '%s' is not a software device", - nm_connection_get_connection_type (connection)); - return NULL; - } - if (!NM_DEVICE_FACTORY_GET_INTERFACE (factory)->get_connection_iface) { g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, - "failed to determine virtual interface name: cannot generate name for %s", + "failed to determine interface name: cannot determine name for %s", nm_connection_get_connection_type (connection)); return NULL; } @@ -207,7 +192,7 @@ nm_device_factory_get_connection_iface (NMDeviceFactory *factory, g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, - "failed to determine virtual interface name: error generating name for %s", + "failed to determine interface name: error determine name for %s", nm_connection_get_connection_type (connection)); return NULL; } @@ -216,7 +201,7 @@ nm_device_factory_get_connection_iface (NMDeviceFactory *factory, g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED, - "failed to determine virtual interface name: invalid name \"%s\" generated", + "failed to determine interface name: name \"%s\" is invalid", ifname); g_free (ifname); return NULL; diff --git a/src/devices/nm-device-factory.h b/src/devices/nm-device-factory.h index 4cd12e12ad..ae78968a42 100644 --- a/src/devices/nm-device-factory.h +++ b/src/devices/nm-device-factory.h @@ -103,8 +103,8 @@ typedef struct { /** * get_connection_iface: * @factory: the #NMDeviceFactory - * @connection: the #NMConnection to return the virtual interface name for - * @parent_iface: parent interface name + * @connection: the #NMConnection to return the interface name for + * @parent_iface: optional parent interface name for virtual devices * * Given a connection, returns the interface name that a device activating * that connection would have.