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.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index b2738ac8bc99..3029cad63a01 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -14,6 +14,7 @@
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
15#define NETLINK_ARPD 8 15#define NETLINK_ARPD 8
16#define NETLINK_AUDIT 9 /* auditing */ 16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10
17#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */ 18#define NETLINK_ROUTE6 11 /* af_inet6 route comm channel */
18#define NETLINK_IP6_FW 13 19#define NETLINK_IP6_FW 13
19#define NETLINK_DNRTMSG 14 /* DECnet routing messages */ 20#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
@@ -146,7 +147,7 @@ struct netlink_callback
146 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 147 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
147 int (*done)(struct netlink_callback *cb); 148 int (*done)(struct netlink_callback *cb);
148 int family; 149 int family;
149 long args[4]; 150 long args[5];
150}; 151};
151 152
152struct netlink_notify 153struct netlink_notify
@@ -156,7 +157,7 @@ struct netlink_notify
156}; 157};
157 158
158static __inline__ struct nlmsghdr * 159static __inline__ struct nlmsghdr *
159__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) 160__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
160{ 161{
161 struct nlmsghdr *nlh; 162 struct nlmsghdr *nlh;
162 int size = NLMSG_LENGTH(len); 163 int size = NLMSG_LENGTH(len);
@@ -164,15 +165,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)); 165 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
165 nlh->nlmsg_type = type; 166 nlh->nlmsg_type = type;
166 nlh->nlmsg_len = size; 167 nlh->nlmsg_len = size;
167 nlh->nlmsg_flags = 0; 168 nlh->nlmsg_flags = flags;
168 nlh->nlmsg_pid = pid; 169 nlh->nlmsg_pid = pid;
169 nlh->nlmsg_seq = seq; 170 nlh->nlmsg_seq = seq;
170 return nlh; 171 return nlh;
171} 172}
172 173
174#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
175({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \
176 goto nlmsg_failure; \
177 __nlmsg_put(skb, pid, seq, type, len, flags); })
178
173#define NLMSG_PUT(skb, pid, seq, type, len) \ 179#define NLMSG_PUT(skb, pid, seq, type, len) \
174({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \ 180 NLMSG_NEW(skb, pid, seq, type, len, 0)
175 __nlmsg_put(skb, pid, seq, type, len); }) 181
182#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
183 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
184 (cb)->nlh->nlmsg_seq, type, len, flags)
185
186#define NLMSG_END(skb, nlh) \
187({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
188 (skb)->len; })
189
190#define NLMSG_CANCEL(skb, nlh) \
191({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
192 -1; })
176 193
177extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 194extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
178 struct nlmsghdr *nlh, 195 struct nlmsghdr *nlh,