platform: fetch objects via the event socket

System Internals / NetworkManager - Thomas Haller [redhat.com] - 17 June 2015 04:41 UTC

Use the event socket to request object via NLM_F_DUMP.

No longer use 'priv->nlh' socket to fetch objects. Instead fetch them via the priv->nlh_event socket that also provides asynchronous events when objects change.

That way, the events are in sync with our explicit requests and we can directly use the events. Previously, the events were only used to indicate that a refetch must happen, so that every event triggered a complete dump of all addresses/routes.

We still use 'priv->nlh' to make synchronous requests such as adding/changing/deleting objects. That means, after we send a request, we must make sure that the result manifested itself at 'nlh_event' socket and the platform cache. That's why we sometimes still must force a dump to sync changes. That could be improved by using only one netlink socket so that we would wait for the ACK of our request.

While not yet perfect, this already significantly reduces the number of fetches. Additionally, before, whenever requesting a dump of addresses or routes (which we did much more often, search for "get_kernel_object for type" log lines), we always dumped IPv4 and IPv6 together. Now only request the addr-family in question.

https://bugzilla.gnome.org/show_bug.cgi?id=747985 https://bugzilla.redhat.com/show_bug.cgi?id=1211133

051cf8b platform: fetch objects via the event socket
src/platform/nm-fake-platform.c | 60 +-
src/platform/nm-linux-platform.c | 1145 ++++++++++++++++++++++---------------
src/platform/tests/test-cleanup.c | 2 +-
src/platform/tests/test-link.c | 37 +-
valgrind.suppressions | 18 -
5 files changed, 754 insertions(+), 508 deletions(-)

Upstream: cgit.freedesktop.org


  • Share