platform: fix caching for link types

System Internals / NetworkManager - Thomas Haller [redhat.com] - 14 February 2014 14:40 UTC

This bug was present since a long time, however libnl3-v3.2.23 (commit fdd1ba220dd7b780400e9d0652cde80e59f63572) changed the returned family of bridge link objects, which breaks NetworkManager.

This resulted in error messages such as:

DBG<4> object.c:207 nl_object_get: New reference to object 0x19c34b0, total 2 DBG<5> route/link.c:895 link_keygen: link 0x19c34b0 key (dev 9 fam 7) keysz 8, hash 0x2b2 DBG<2> hashtable.c:127 nl_hash_table_add: Warning: Add to hashtable found duplicate... DBG<4> object.c:221 nl_object_put: Returned object reference 0x19c34b0, 1 remaining NetworkManager[17745]: [1392114373.475432] [platform/nm-linux-platform.c:1328] event_notification(): netlink cache error: Object exists

Even before the change of libnl, I saw the following error lines [...] [platform/nm-linux-platform.c:1216] event_notification(): netlink event (type 16) for link: virbr0 (4) [...] [platform/nm-linux-platform.c:1265] event_notification(): netlink cache error: Object exists Hence, the caching mechanism for libnl objects already had a bug.

For rtnl link objects, the identifier consists of family and ifindex. Since in upper layers, we don't easily know the family, we need a way to find the objects inside the cache. We do this, by only caching links of family AF_UNSPEC.

Objects that we receive via event_notification() are never cached. They are only used to trigger refetching the kernel_object. Their family is irrelevant, we only need to know, that something about this ifindex changed.

For objects retrieved via get_kernel_object(), we only get link objects of family AF_UNSPEC or AF_BRIDGE. In any case, we reset (coerce) their family before caching. This way, inside the link cache, there are only objects with (coerced) family AF_UNSPEC. We loose the information, which family the link had, however we don't need it anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=719905 https://bugzilla.redhat.com/show_bug.cgi?id=1063290

Duplicates: https://bugzilla.gnome.org/show_bug.cgi?id=724225 https://bugzilla.redhat.com/show_bug.cgi?id=1063800

a6f9266 platform: fix caching for link types
src/platform/nm-linux-platform.c | 52 +++++++++++++++++++++++++++-----------
1 file changed, 37 insertions(+), 15 deletions(-)

Upstream: cgit.freedesktop.org


  • Share