aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-12-27 02:20:30 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-27 02:20:30 -0500
commit24f626d3439f61d87fca0c0c07f614fba41a4e92 (patch)
treeadc927b4f3fb05268c6ca808aee5d0109351fec1 /include
parenteb46e2215fc6bdaaf8eda3a6c7c0dd033d171cad (diff)
parentc380d9a7afff0e4c2e5f3c1c2dc7d2f4214dd962 (diff)
Merge branch 'netlink_multicast'
Johannes Berg says: ==================== netlink/genetlink cleanups & multicast improvements I'm looking at using the multicast group functionality in a way that would benefit from knowing when there are subscribers to avoid collecting the required data when there aren't any. During this I noticed that the unbind for multicast groups doesn't actually work - it's never called when sockets are closed. Luckily, nobody actually uses the functionality. While looking at the code trying to find why it's not called and where the multicast listeners are actually removed, I found the potential cleanup in patch 3. Patch 2 also has a cleanup for a generic netlink API in this area. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/genetlink.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index af10c2cf8a1d..3ed31e5a445b 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -31,6 +31,9 @@ struct genl_info;
31 * do additional, common, filtering and return an error 31 * do additional, common, filtering and return an error
32 * @post_doit: called after an operation's doit callback, it may 32 * @post_doit: called after an operation's doit callback, it may
33 * undo operations done by pre_doit, for example release locks 33 * undo operations done by pre_doit, for example release locks
34 * @mcast_bind: a socket bound to the given multicast group (which
35 * is given as the offset into the groups array)
36 * @mcast_unbind: a socket was unbound from the given multicast group
34 * @attrbuf: buffer to store parsed attributes 37 * @attrbuf: buffer to store parsed attributes
35 * @family_list: family list 38 * @family_list: family list
36 * @mcgrps: multicast groups used by this family (private) 39 * @mcgrps: multicast groups used by this family (private)
@@ -53,6 +56,8 @@ struct genl_family {
53 void (*post_doit)(const struct genl_ops *ops, 56 void (*post_doit)(const struct genl_ops *ops,
54 struct sk_buff *skb, 57 struct sk_buff *skb,
55 struct genl_info *info); 58 struct genl_info *info);
59 int (*mcast_bind)(int group);
60 void (*mcast_unbind)(int group);
56 struct nlattr ** attrbuf; /* private */ 61 struct nlattr ** attrbuf; /* private */
57 const struct genl_ops * ops; /* private */ 62 const struct genl_ops * ops; /* private */
58 const struct genl_multicast_group *mcgrps; /* private */ 63 const struct genl_multicast_group *mcgrps; /* private */
@@ -395,11 +400,11 @@ static inline int genl_set_err(struct genl_family *family, struct net *net,
395} 400}
396 401
397static inline int genl_has_listeners(struct genl_family *family, 402static inline int genl_has_listeners(struct genl_family *family,
398 struct sock *sk, unsigned int group) 403 struct net *net, unsigned int group)
399{ 404{
400 if (WARN_ON_ONCE(group >= family->n_mcgrps)) 405 if (WARN_ON_ONCE(group >= family->n_mcgrps))
401 return -EINVAL; 406 return -EINVAL;
402 group = family->mcgrp_offset + group; 407 group = family->mcgrp_offset + group;
403 return netlink_has_listeners(sk, group); 408 return netlink_has_listeners(net->genl_sock, group);
404} 409}
405#endif /* __NET_GENERIC_NETLINK_H */ 410#endif /* __NET_GENERIC_NETLINK_H */