netlink: simplify netlink callback handling

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

With libnl3, each socket has it's own callback structure. One would often take that callback structure, clone it, modify it and invoke a receive operation with it.

We don't need this complexity. We got rid of all default handlers, hence, by default all callbacks are unset.

The only callbacks that are set, are those that we specify immediately before invoking the receive operation. Just pass the callback structure at that point.

Also, no more ref-counting, and cloning of the callback structure. It is so simple, just stack allocate one if you need it.

a7bda2ed1 netlink: simplify netlink callback handling
src/platform/nm-netlink.c | 228 +++++++--------------------------
src/platform/nm-netlink.h | 49 ++-----
src/platform/wifi/wifi-utils-nl80211.c | 89 ++++++-------
3 files changed, 92 insertions(+), 274 deletions(-)

Upstream: cgit.freedesktop.org


  • Share