aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r--include/linux/netlink.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index f74dd133788f..f80c56ac4d82 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -153,6 +153,8 @@ struct nlattr {
153 153
154#include <linux/capability.h> 154#include <linux/capability.h>
155#include <linux/skbuff.h> 155#include <linux/skbuff.h>
156#include <linux/export.h>
157#include <net/scm.h>
156 158
157struct net; 159struct net;
158 160
@@ -162,9 +164,10 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
162} 164}
163 165
164struct netlink_skb_parms { 166struct netlink_skb_parms {
165 struct ucred creds; /* Skb credentials */ 167 struct scm_creds creds; /* Skb credentials */
166 __u32 pid; 168 __u32 portid;
167 __u32 dst_group; 169 __u32 dst_group;
170 struct sock *ssk;
168}; 171};
169 172
170#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 173#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
@@ -174,17 +177,27 @@ struct netlink_skb_parms {
174extern void netlink_table_grab(void); 177extern void netlink_table_grab(void);
175extern void netlink_table_ungrab(void); 178extern void netlink_table_ungrab(void);
176 179
180#define NL_CFG_F_NONROOT_RECV (1 << 0)
181#define NL_CFG_F_NONROOT_SEND (1 << 1)
182
177/* optional Netlink kernel configuration parameters */ 183/* optional Netlink kernel configuration parameters */
178struct netlink_kernel_cfg { 184struct netlink_kernel_cfg {
179 unsigned int groups; 185 unsigned int groups;
186 unsigned int flags;
180 void (*input)(struct sk_buff *skb); 187 void (*input)(struct sk_buff *skb);
181 struct mutex *cb_mutex; 188 struct mutex *cb_mutex;
182 void (*bind)(int group); 189 void (*bind)(int group);
183}; 190};
184 191
185extern struct sock *netlink_kernel_create(struct net *net, int unit, 192extern struct sock *__netlink_kernel_create(struct net *net, int unit,
186 struct module *module, 193 struct module *module,
187 struct netlink_kernel_cfg *cfg); 194 struct netlink_kernel_cfg *cfg);
195static inline struct sock *
196netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
197{
198 return __netlink_kernel_create(net, unit, THIS_MODULE, cfg);
199}
200
188extern void netlink_kernel_release(struct sock *sk); 201extern void netlink_kernel_release(struct sock *sk);
189extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); 202extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
190extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 203extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
@@ -192,14 +205,14 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)
192extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 205extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
193extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 206extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
194extern int netlink_has_listeners(struct sock *sk, unsigned int group); 207extern int netlink_has_listeners(struct sock *sk, unsigned int group);
195extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 208extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
196extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 209extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
197 __u32 group, gfp_t allocation); 210 __u32 group, gfp_t allocation);
198extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, 211extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
199 __u32 pid, __u32 group, gfp_t allocation, 212 __u32 portid, __u32 group, gfp_t allocation,
200 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), 213 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
201 void *filter_data); 214 void *filter_data);
202extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 215extern int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code);
203extern int netlink_register_notifier(struct notifier_block *nb); 216extern int netlink_register_notifier(struct notifier_block *nb);
204extern int netlink_unregister_notifier(struct notifier_block *nb); 217extern int netlink_unregister_notifier(struct notifier_block *nb);
205 218
@@ -240,12 +253,12 @@ struct netlink_callback {
240 253
241struct netlink_notify { 254struct netlink_notify {
242 struct net *net; 255 struct net *net;
243 int pid; 256 int portid;
244 int protocol; 257 int protocol;
245}; 258};
246 259
247struct nlmsghdr * 260struct nlmsghdr *
248__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); 261__nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
249 262
250struct netlink_dump_control { 263struct netlink_dump_control {
251 int (*dump)(struct sk_buff *skb, struct netlink_callback *); 264 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
@@ -258,11 +271,6 @@ extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
258 const struct nlmsghdr *nlh, 271 const struct nlmsghdr *nlh,
259 struct netlink_dump_control *control); 272 struct netlink_dump_control *control);
260 273
261
262#define NL_NONROOT_RECV 0x1
263#define NL_NONROOT_SEND 0x2
264extern void netlink_set_nonroot(int protocol, unsigned flag);
265
266#endif /* __KERNEL__ */ 274#endif /* __KERNEL__ */
267 275
268#endif /* __LINUX_NETLINK_H */ 276#endif /* __LINUX_NETLINK_H */