Re: Bugreport: macvlan device choosing wrong parent device

On Tue, Sep 26, 2017 at 09:36:44AM +0200, Ulrich Ölmann wrote:
Hi there,
So far so good. The problem is met when the connections are teared down and
NetworkManager is finally restarted:
NetworkManager obviously created the MAC VLAN device on top of eth0 now which
seems to be a bug (especially as eth0 was declared to be unmanaged). As a result
NetworkManager is not able to create the needed internal resources which is
logged in the journal:

    device (eth0): link connected
    manager: (eth0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/2)
    manager: (link-local): new Macvlan device (/org/freedesktop/NetworkManager/Devices/3)
    device (eth1): link connected
    manager: (eth1): new Ethernet device (/org/freedesktop/NetworkManager/Devices/4)
    manager: (link-local) can't register the device with manager: A device with ifindex 7 already exists

It looks like NetworkManager does not create the devices in the correct order in
contrast to what has been done manually before restarting NetworkManager. This
behaviour is only seen if the parent is referenced via a UUID. Using an
interface name instead ("parent=eth1"), everything is fine.


as it is currently implemented, "parent=$UUID" in the connection file
means that the parent device will be the device on which connection
$UUID is currently active or, if none, any device compatibile with
$UUID; there isn't any sort of temporal dependency implied by the

Since connection 7ac61f21-bf59-4c4c-ae38-51ce131b2afc does not specify
an interface name, at startup NM can match it with any interface and
chooses the wrong (unmanaged) one. This is a bug and should be easy to
fix, as in the patch below.

As you already found, setting parent=$INTERFACE should work around
this bug, as well as setting the interface name in the parent


diff --git a/src/nm-manager.c b/src/nm-manager.c
index d0429fe9e..2e47a9759 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1155,6 +1155,10 @@ find_parent_device_for_connection (NMManager *self, NMConnection *connection, NM
        for (iter = priv->devices; iter; iter = iter->next) {
                NMDevice *candidate = iter->data;

+               /* Unmanaged devices are not compatible with any connection */
+               if (!nm_device_get_managed (candidate, FALSE))
+                       continue;
                if (nm_device_get_settings_connection (candidate) == parent_connection)
                        return candidate;


Attachment: signature.asc
Description: PGP signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]