diff options
Diffstat (limited to 'include/net/genetlink.h')
-rw-r--r-- | include/net/genetlink.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index af10c2cf8a1d..6c92415311ca 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -27,10 +27,18 @@ struct genl_info; | |||
27 | * @maxattr: maximum number of attributes supported | 27 | * @maxattr: maximum number of attributes supported |
28 | * @netnsok: set to true if the family can handle network | 28 | * @netnsok: set to true if the family can handle network |
29 | * namespaces and should be presented in all of them | 29 | * namespaces and should be presented in all of them |
30 | * @parallel_ops: operations can be called in parallel and aren't | ||
31 | * synchronized by the core genetlink code | ||
30 | * @pre_doit: called before an operation's doit callback, it may | 32 | * @pre_doit: called before an operation's doit callback, it may |
31 | * do additional, common, filtering and return an error | 33 | * do additional, common, filtering and return an error |
32 | * @post_doit: called after an operation's doit callback, it may | 34 | * @post_doit: called after an operation's doit callback, it may |
33 | * undo operations done by pre_doit, for example release locks | 35 | * undo operations done by pre_doit, for example release locks |
36 | * @mcast_bind: a socket bound to the given multicast group (which | ||
37 | * is given as the offset into the groups array) | ||
38 | * @mcast_unbind: a socket was unbound from the given multicast group. | ||
39 | * Note that unbind() will not be called symmetrically if the | ||
40 | * generic netlink family is removed while there are still open | ||
41 | * sockets. | ||
34 | * @attrbuf: buffer to store parsed attributes | 42 | * @attrbuf: buffer to store parsed attributes |
35 | * @family_list: family list | 43 | * @family_list: family list |
36 | * @mcgrps: multicast groups used by this family (private) | 44 | * @mcgrps: multicast groups used by this family (private) |
@@ -53,6 +61,8 @@ struct genl_family { | |||
53 | void (*post_doit)(const struct genl_ops *ops, | 61 | void (*post_doit)(const struct genl_ops *ops, |
54 | struct sk_buff *skb, | 62 | struct sk_buff *skb, |
55 | struct genl_info *info); | 63 | struct genl_info *info); |
64 | int (*mcast_bind)(struct net *net, int group); | ||
65 | void (*mcast_unbind)(struct net *net, int group); | ||
56 | struct nlattr ** attrbuf; /* private */ | 66 | struct nlattr ** attrbuf; /* private */ |
57 | const struct genl_ops * ops; /* private */ | 67 | const struct genl_ops * ops; /* private */ |
58 | const struct genl_multicast_group *mcgrps; /* private */ | 68 | const struct genl_multicast_group *mcgrps; /* private */ |
@@ -395,11 +405,11 @@ static inline int genl_set_err(struct genl_family *family, struct net *net, | |||
395 | } | 405 | } |
396 | 406 | ||
397 | static inline int genl_has_listeners(struct genl_family *family, | 407 | static inline int genl_has_listeners(struct genl_family *family, |
398 | struct sock *sk, unsigned int group) | 408 | struct net *net, unsigned int group) |
399 | { | 409 | { |
400 | if (WARN_ON_ONCE(group >= family->n_mcgrps)) | 410 | if (WARN_ON_ONCE(group >= family->n_mcgrps)) |
401 | return -EINVAL; | 411 | return -EINVAL; |
402 | group = family->mcgrp_offset + group; | 412 | group = family->mcgrp_offset + group; |
403 | return netlink_has_listeners(sk, group); | 413 | return netlink_has_listeners(net->genl_sock, group); |
404 | } | 414 | } |
405 | #endif /* __NET_GENERIC_NETLINK_H */ | 415 | #endif /* __NET_GENERIC_NETLINK_H */ |