diff options
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r-- | include/linux/netlink.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index b2738ac8bc99..e38407a23d04 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -156,7 +156,7 @@ struct netlink_notify | |||
156 | }; | 156 | }; |
157 | 157 | ||
158 | static __inline__ struct nlmsghdr * | 158 | static __inline__ struct nlmsghdr * |
159 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) | 159 | __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) |
160 | { | 160 | { |
161 | struct nlmsghdr *nlh; | 161 | struct nlmsghdr *nlh; |
162 | int size = NLMSG_LENGTH(len); | 162 | int size = NLMSG_LENGTH(len); |
@@ -164,15 +164,31 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) | |||
164 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); | 164 | nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); |
165 | nlh->nlmsg_type = type; | 165 | nlh->nlmsg_type = type; |
166 | nlh->nlmsg_len = size; | 166 | nlh->nlmsg_len = size; |
167 | nlh->nlmsg_flags = 0; | 167 | nlh->nlmsg_flags = flags; |
168 | nlh->nlmsg_pid = pid; | 168 | nlh->nlmsg_pid = pid; |
169 | nlh->nlmsg_seq = seq; | 169 | nlh->nlmsg_seq = seq; |
170 | return nlh; | 170 | return nlh; |
171 | } | 171 | } |
172 | 172 | ||
173 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ | ||
174 | ({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ | ||
175 | goto nlmsg_failure; \ | ||
176 | __nlmsg_put(skb, pid, seq, type, len, flags); }) | ||
177 | |||
173 | #define NLMSG_PUT(skb, pid, seq, type, len) \ | 178 | #define NLMSG_PUT(skb, pid, seq, type, len) \ |
174 | ({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \ | 179 | NLMSG_NEW(skb, pid, seq, type, len, 0) |
175 | __nlmsg_put(skb, pid, seq, type, len); }) | 180 | |
181 | #define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \ | ||
182 | NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \ | ||
183 | (cb)->nlh->nlmsg_seq, type, len, flags) | ||
184 | |||
185 | #define NLMSG_END(skb, nlh) \ | ||
186 | ({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \ | ||
187 | (skb)->len; }) | ||
188 | |||
189 | #define NLMSG_CANCEL(skb, nlh) \ | ||
190 | ({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \ | ||
191 | -1; }) | ||
176 | 192 | ||
177 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | 193 | extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, |
178 | struct nlmsghdr *nlh, | 194 | struct nlmsghdr *nlh, |