summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-netlink/netlink-internal.h
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/libsystemd/sd-netlink/netlink-internal.h
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/libsystemd/sd-netlink/netlink-internal.h')
-rw-r--r--src/libsystemd/sd-netlink/netlink-internal.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-internal.h b/src/libsystemd/sd-netlink/netlink-internal.h
index 4026e2c341..b9cb80668d 100644
--- a/src/libsystemd/sd-netlink/netlink-internal.h
+++ b/src/libsystemd/sd-netlink/netlink-internal.h
@@ -64,6 +64,9 @@ struct sd_netlink {
struct sockaddr_nl nl;
} sockaddr;
+ Hashmap *broadcast_group_refs;
+ bool broadcast_group_dont_leave:1; /* until we can rely on 4.2 */
+
sd_netlink_message **rqueue;
unsigned rqueue_size;
size_t rqueue_allocated;
@@ -124,7 +127,8 @@ int message_new_empty(sd_netlink *rtnl, sd_netlink_message **ret);
int socket_open(int family);
int socket_bind(sd_netlink *nl);
-int socket_join_broadcast_group(sd_netlink *nl, unsigned group);
+int socket_broadcast_group_ref(sd_netlink *nl, unsigned group);
+int socket_broadcast_group_unref(sd_netlink *nl, unsigned group);
int socket_write_message(sd_netlink *nl, sd_netlink_message *m);
int socket_read_message(sd_netlink *nl);