From 9c5a882b7fc256ddc0b227677fa06546f0e944a8 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Thu, 15 Oct 2015 17:59:10 +0200 Subject: sd-netlink: refcount multicast groups Track the number of matches installed for a given multicast group, and leave the group once no matches depend on it. In order to handle passed-in sockets that are already members of multicast groups we initialize the refcount based on the membership once we take over the socket. This way we will leave the socket in the state we found it once we finish with it. On kernels that do not fully support reading out the multicast group membership we fall back to never leaving any groups (as before). --- src/basic/missing.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/basic') diff --git a/src/basic/missing.h b/src/basic/missing.h index 59e835a466..5fb9951a84 100644 --- a/src/basic/missing.h +++ b/src/basic/missing.h @@ -126,6 +126,10 @@ #define SOL_NETLINK 270 #endif +#ifndef NETLINK_LIST_MEMBERSHIPS +#define NETLINK_LIST_MEMBERSHIPS 9 +#endif + #if !HAVE_DECL_PIVOT_ROOT static inline int pivot_root(const char *new_root, const char *put_old) { return syscall(SYS_pivot_root, new_root, put_old); -- cgit v1.2.3-54-g00ecf