4 #include <linux/rhashtable.h>
5 #include <linux/atomic.h>
8 #define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
9 #define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
12 /* struct sock has to be the first member of netlink_sock */
20 unsigned long *groups
;
22 size_t max_recvmsg_len
;
23 wait_queue_head_t wait
;
26 struct netlink_callback cb
;
27 struct mutex
*cb_mutex
;
28 struct mutex cb_def_mutex
;
29 void (*netlink_rcv
)(struct sk_buff
*skb
);
30 int (*netlink_bind
)(struct net
*net
, int group
);
31 void (*netlink_unbind
)(struct net
*net
, int group
);
32 struct module
*module
;
34 struct rhash_head node
;
38 static inline struct netlink_sock
*nlk_sk(struct sock
*sk
)
40 return container_of(sk
, struct netlink_sock
, sk
);
43 struct netlink_table
{
44 struct rhashtable hash
;
45 struct hlist_head mc_list
;
46 struct listeners __rcu
*listeners
;
49 struct mutex
*cb_mutex
;
50 struct module
*module
;
51 int (*bind
)(struct net
*net
, int group
);
52 void (*unbind
)(struct net
*net
, int group
);
53 bool (*compare
)(struct net
*net
, struct sock
*sock
);
57 extern struct netlink_table
*nl_table
;
58 extern rwlock_t nl_table_lock
;