summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-15 17:59:10 +0200
committerTom Gundersen <teg@jklm.no>2015-10-15 18:59:08 +0200
commit9c5a882b7fc256ddc0b227677fa06546f0e944a8 (patch)
tree4aa947709c998d12e77acbfe21264aa2c2c79404 /src/basic
parentf10dc5a72587cb35ef8e4f1babcb274ccb4afd45 (diff)
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).
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/missing.h4
1 files changed, 4 insertions, 0 deletions
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);