aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/priv_netlink.h
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-12-18 15:22:35 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-18 15:22:35 (GMT)
commitf37cf89ccb4f9c8a74ba8979f60bf3979f44d87e (patch)
tree2d0857f693fca23ef8793c8bd8066aaf49da594b /src/drivers/priv_netlink.h
parent08063178fb48e2ee2f46b345326890ac295e2cfa (diff)
downloadhostap-f37cf89ccb4f9c8a74ba8979f60bf3979f44d87e.zip
hostap-f37cf89ccb4f9c8a74ba8979f60bf3979f44d87e.tar.gz
hostap-f37cf89ccb4f9c8a74ba8979f60bf3979f44d87e.tar.bz2
netlink: Use NLMSG_OK and NLMSG_NEXT macros
Diffstat (limited to 'src/drivers/priv_netlink.h')
-rw-r--r--src/drivers/priv_netlink.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/drivers/priv_netlink.h b/src/drivers/priv_netlink.h
index 0ab0bb2..23eff83 100644
--- a/src/drivers/priv_netlink.h
+++ b/src/drivers/priv_netlink.h
@@ -57,6 +57,12 @@
#define NLMSG_LENGTH(len) ((len) + NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
#define NLMSG_DATA(nlh) ((void*) (((char*) nlh) + NLMSG_LENGTH(0)))
+#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
+ (struct nlmsghdr *) \
+ (((char *)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
+#define NLMSG_OK(nlh,len) ((len) >= (int) sizeof(struct nlmsghdr) && \
+ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
+ (int) (nlh)->nlmsg_len <= (len))
#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
#define RTA_ALIGNTO 4