aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/priv_netlink.h
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-12-18 14:14:54 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-18 14:14:54 (GMT)
commit3b31db5199dba0b3749d92ca4fe6633694711fa8 (patch)
tree66494d74c0467a589e41232e399258bd066b4c4b /src/drivers/priv_netlink.h
parent0e15e529eb201478954c7104ebb22edb7fb4359b (diff)
downloadhostap-3b31db5199dba0b3749d92ca4fe6633694711fa8.zip
hostap-3b31db5199dba0b3749d92ca4fe6633694711fa8.tar.gz
hostap-3b31db5199dba0b3749d92ca4fe6633694711fa8.tar.bz2
Fix netlink payload length calculation
nlmsghdr length needs to be removed from payload length. [Bug 341]
Diffstat (limited to 'src/drivers/priv_netlink.h')
-rw-r--r--src/drivers/priv_netlink.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/drivers/priv_netlink.h b/src/drivers/priv_netlink.h
index 2a31e25..0ab0bb2 100644
--- a/src/drivers/priv_netlink.h
+++ b/src/drivers/priv_netlink.h
@@ -53,8 +53,11 @@
#define NLMSG_ALIGNTO 4
#define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1))
+#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
#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_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
#define RTA_ALIGNTO 4
#define RTA_ALIGN(len) (((len) + RTA_ALIGNTO - 1) & ~(RTA_ALIGNTO - 1))