diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h index c94f093e66..ba83647afa 100644 --- a/libnm/NetworkManager.h +++ b/libnm/NetworkManager.h @@ -34,6 +34,7 @@ #include "nm-device-ppp.h" #include "nm-device-team.h" #include "nm-device-tun.h" +#include "nm-device-veth.h" #include "nm-device-vlan.h" #include "nm-device-vxlan.h" #include "nm-device-wifi-p2p.h" diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c index bf4a36fee0..6513e7b7da 100644 --- a/libnm/nm-device-ethernet.c +++ b/libnm/nm-device-ethernet.c @@ -315,7 +315,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wired = NML_DBUS_META_IFACE_INIT_PROP( NM_DBUS_INTERFACE_DEVICE_WIRED, nm_device_ethernet_get_type, - NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30, + NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20, NML_DBUS_META_IFACE_DBUS_PROPERTIES( NML_DBUS_META_PROPERTY_INIT_B("Carrier", PROP_CARRIER, NMDeviceEthernetPrivate, carrier), NML_DBUS_META_PROPERTY_INIT_FCN("HwAddress", diff --git a/libnm/nm-device-veth.c b/libnm/nm-device-veth.c index 9f00cd8a6e..c19250d6c0 100644 --- a/libnm/nm-device-veth.c +++ b/libnm/nm-device-veth.c @@ -84,7 +84,7 @@ nm_device_veth_init(NMDeviceVeth *device) const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_veth = NML_DBUS_META_IFACE_INIT_PROP(NM_DBUS_INTERFACE_DEVICE_VETH, nm_device_veth_get_type, - NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20, + NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30, NML_DBUS_META_IFACE_DBUS_PROPERTIES( NML_DBUS_META_PROPERTY_INIT_O_PROP("Peer", PROP_PEER, diff --git a/libnm/nm-device.c b/libnm/nm-device.c index c57f7ce659..5b55cf80b2 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -1223,8 +1223,11 @@ nm_device_get_type_description(NMDevice *device) } typename = G_OBJECT_TYPE_NAME(device); - if (g_str_has_prefix(typename, "NMDevice")) + if (g_str_has_prefix(typename, "NMDevice")) { typename += 8; + if (nm_streq(typename, "Veth")) + typename = "Ethernet"; + } priv->type_description = g_ascii_strdown(typename, -1); return _nml_coerce_property_str_not_empty(priv->type_description); diff --git a/libnm/nm-libnm-utils.h b/libnm/nm-libnm-utils.h index 86e7b304b1..ae9c5c25d0 100644 --- a/libnm/nm-libnm-utils.h +++ b/libnm/nm-libnm-utils.h @@ -527,6 +527,12 @@ struct _NMLDBusMetaIface { * %NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_10, and depending on whether there is * a "org.freedesktop.NetworkManager.VPN.Connection" (with high priority), we create * one or the other type. + * + * Another exception is "org.freedesktop.NetworkManager.Device.Veth". It is a NMDeviceVeth + * and the parent is NMDeviceEthernet. Therefore it contains "org.freedesktop.NetworkManager.Device.Wired" + * as it should be registered as NMDeviceVeth, the profile has priority + * %NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20. + * */ NMLDBusMetaInteracePrio interface_prio : 3; }; diff --git a/libnm/tests/test-libnm.c b/libnm/tests/test-libnm.c index 27f0a7cc01..976b98e722 100644 --- a/libnm/tests/test-libnm.c +++ b/libnm/tests/test-libnm.c @@ -3232,6 +3232,11 @@ test_dbus_meta_types(void) { NM_DBUS_INTERFACE_DEVICE_WIRED, NM_TYPE_DEVICE_ETHERNET, + NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20, + }, + { + NM_DBUS_INTERFACE_DEVICE_VETH, + NM_TYPE_DEVICE_VETH, NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30, }, { diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 38be8c8002..e27b71c6f2 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3778,8 +3778,11 @@ get_type_description(NMDevice *self) gs_free char *s = NULL; typename = G_OBJECT_TYPE_NAME(self); - if (g_str_has_prefix(typename, "NMDevice")) + if (g_str_has_prefix(typename, "NMDevice")) { typename += 8; + if (nm_streq(typename, "Veth")) + typename = "Ethernet"; + } s = g_ascii_strdown(typename, -1); klass->default_type_description = g_intern_string(s); klass->default_type_description_klass = klass;