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.h30
1 files changed, 11 insertions, 19 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 52e48959cfa1..a2092f582a78 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -225,6 +225,7 @@ struct netlink_callback {
225 int (*dump)(struct sk_buff * skb, 225 int (*dump)(struct sk_buff * skb,
226 struct netlink_callback *cb); 226 struct netlink_callback *cb);
227 int (*done)(struct netlink_callback *cb); 227 int (*done)(struct netlink_callback *cb);
228 void *data;
228 u16 family; 229 u16 family;
229 u16 min_dump_alloc; 230 u16 min_dump_alloc;
230 unsigned int prev_seq, seq; 231 unsigned int prev_seq, seq;
@@ -237,22 +238,8 @@ struct netlink_notify {
237 int protocol; 238 int protocol;
238}; 239};
239 240
240static __inline__ struct nlmsghdr * 241struct nlmsghdr *
241__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) 242__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags);
242{
243 struct nlmsghdr *nlh;
244 int size = NLMSG_LENGTH(len);
245
246 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
247 nlh->nlmsg_type = type;
248 nlh->nlmsg_len = size;
249 nlh->nlmsg_flags = flags;
250 nlh->nlmsg_pid = pid;
251 nlh->nlmsg_seq = seq;
252 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
253 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
254 return nlh;
255}
256 243
257#define NLMSG_NEW(skb, pid, seq, type, len, flags) \ 244#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
258({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ 245({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
@@ -262,11 +249,16 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
262#define NLMSG_PUT(skb, pid, seq, type, len) \ 249#define NLMSG_PUT(skb, pid, seq, type, len) \
263 NLMSG_NEW(skb, pid, seq, type, len, 0) 250 NLMSG_NEW(skb, pid, seq, type, len, 0)
264 251
252struct netlink_dump_control {
253 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
254 int (*done)(struct netlink_callback*);
255 void *data;
256 u16 min_dump_alloc;
257};
258
265extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 259extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
266 const struct nlmsghdr *nlh, 260 const struct nlmsghdr *nlh,
267 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 261 struct netlink_dump_control *control);
268 int (*done)(struct netlink_callback*),
269 u16 min_dump_alloc);
270 262
271 263
272#define NL_NONROOT_RECV 0x1 264#define NL_NONROOT_RECV 0x1