merge branch 'ffmancera/eth_prio'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/707
This commit is contained in:
Beniamino Galvani 2020-12-14 17:58:40 +01:00
commit a60ea8af7d
7 changed files with 22 additions and 4 deletions

View file

@ -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"

View file

@ -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",

View file

@ -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,

View file

@ -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);

View file

@ -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;
};

View file

@ -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,
},
{

View file

@ -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;