platform: parse netlink messages ourselves without libnl-route-3
authorThomas Haller <thaller@redhat.com>
Mon, 12 Oct 2015 14:07:01 +0000 (16:07 +0200)
committerThomas Haller <thaller@redhat.com>
Sun, 1 Nov 2015 16:28:08 +0000 (17:28 +0100)
commit4a209564008f73a2c6e8afae5003b15af4301c81
tree16c8bb7a54d0f2cc004cbe30083ff4695b3528b8
parent25751f9c57baa3c5bd6579010109d63238a781b8
platform: parse netlink messages ourselves without libnl-route-3

Constructing the libnl3 object only to parse the message
is wasteful. It involves several memory allocations, thread
synchronization and parsing fields that we don't care about.

But moreover, older libnl version might not support all the
fields we are interested in, hence we have workarounds like
_nl_link_parse_info_data(). Certain features might not fully
work unless libnl supports it too (although kernel would).

As we already parse the data ourselves sometimes, just go
all they way and don't construct the intermediate libnl object.

This will allow us to drop the _nl_link_parse_info_data() workarounds
in next commits. That is important, because _nl_link_parse_info_data()
sidesteps our platform cache and is not in sync with the cache (not to
mention the extra work to explicitly refetch the data on every lookup).

Also, it gets us 60% on the way to no longer needing 'libnl-route-3.so'
at all and eventually drop requiring the library.
configure.ac
src/platform/nm-linux-platform.c
src/platform/nm-platform.c
src/platform/nm-platform.h
src/platform/nmp-object.c
src/platform/nmp-object.h