summaryrefslogtreecommitdiffstats
path: root/libnfnetlink.h
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2005-07-18 19:11:45 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2005-07-18 19:11:45 +0000
commitdc44aeeddc218d9ae45006b15fbcde751567a2ef (patch)
treec026b160b5622509b7fc8d1a4df5c8d1f47811c1 /libnfnetlink.h
parent84d14671e9de8d1d9e587086efca623d843d4b63 (diff)
- introduce NLMSG_TAIL
- introduce support for nested attributes (Pablo Neira)
Diffstat (limited to 'libnfnetlink.h')
-rw-r--r--libnfnetlink.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libnfnetlink.h b/libnfnetlink.h
index 944e607..9761eed 100644
--- a/libnfnetlink.h
+++ b/libnfnetlink.h
@@ -10,6 +10,9 @@
#include <linux/netlink.h>
#include <linux/netfilter/nfnetlink.h>
+#define NLMSG_TAIL(nlh) \
+ ((void *) (nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)
+
#define NFNL_BUFFSIZE 8192
struct nfnl_handle {
@@ -45,6 +48,12 @@ extern int nfnl_addattr32(struct nlmsghdr *, int, int, u_int32_t);
extern int nfnl_nfa_addattr_l(struct nfattr *, int, int, void *, int);
extern int nfnl_nfa_addattr32(struct nfattr *, int, int, u_int32_t);
extern int nfnl_parse_attr(struct nfattr **, int, struct nfattr *, int);
+#define nfnl_nest(nlh, bufsize, type) \
+({ struct nfattr *__start = NLMSG_TAIL(nlh); \
+ nfnl_addattr_l(nlh, bufsize, type, NULL, 0); \
+ __start; })
+#define nfnl_nest_end(nlh, tail) \
+({ (tail)->nfa_len = (void *) NLMSG_TAIL(nlh) - (void *) tail; })
extern void nfnl_dump_packet(struct nlmsghdr *, int, char *);
#endif /* __LIBNFNETLINK_H */