netlink: drop libnl3 dependency

System Internals / NetworkManager - Thomas Haller [redhat.com] - 21 February 2018 11:08 EST

From libnl3, we only used the helper function to parse/generate netlink messages and the socket functions to send/receive messages. We don't need an external dependency to do that, it is simple enough.

Drop the libnl3 dependency, and replace all missing code by directly copying it from libnl3 sources. At this point, I mostly tried to import the required bits to make it working with few modifications.

Note that this increases the binary size of NetworkManager by 4736 bytes for contrib/rpm build on x86_64. In the future, we can simplify the code further.

A few modifications from libnl3 are:

- netlink errors NLE_* are now in the domain or regular errno. The distinction of having to bother with two kinds of error number domains was annoying.

- parts of the callback handling is copied partially and unused parts are dropped. Especially, the verbose/debug handlers are not used. In following commits, the callback handling will be significantly simplified.

- the complex handling of seleting ports was simplified. We now always let kernel choose the right port automatically.

3fab322a2 netlink: drop libnl3 dependency
.travis.yml | 4 -
Makefile.am | 9 +-
configure.ac | 3 -
contrib/fedora/REQUIRED_PACKAGES | 1 -
contrib/fedora/nm-live-vm/build.sh | 2 +-
contrib/fedora/rpm/NetworkManager.spec | 2 -
meson.build | 3 -
src/meson.build | 4 -
src/platform/nm-linux-platform.c | 6 +-
src/platform/nm-netlink.c | 1456 +++++++++++++++++++++++++++++++-
src/platform/nm-netlink.h | 500 ++++++++++-
src/platform/wifi/wifi-utils-nl80211.c | 4 +-
12 files changed, 1934 insertions(+), 60 deletions(-)

Upstream: cgit.freedesktop.org


  • Share