libnm: NMDeviceEthernet uses PRIO_20 instead of PRIO_30

As NMDeviceVeth has a NMDeviceEthernet as parent, it should use PRIO_20
in order to report NMDeviceVeth when configured and do not report
NMDeviceEthernet.

An unit test case has been added.

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
This commit is contained in:
Fernando Fernandez Mancera 2020-12-01 18:38:41 +01:00
parent c7a470dd66
commit 3dc202579e
5 changed files with 14 additions and 2 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

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