netlink: add NLMSG_OK definition

Change-Id: I4ab4cabd1e6950802eda360d972d2ef5cea30da2
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2020-03-26 16:51:52 +08:00 committed by Alin Jerpelea
parent 80c90399e6
commit 9a9d76744b
1 changed files with 3 additions and 0 deletions

View File

@ -136,6 +136,9 @@
((n) -= NLMSG_ALIGN((hdr)->nlmsg_len), \
(FAR struct nlmsghdr*) \
(((FAR char*)(hdr)) + NLMSG_ALIGN((hdr)->nlmsg_len)))
#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
(nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
(nlh)->nlmsg_len <= (len))
#define NLMSG_PAYLOAD(hdr, len) \
((hdr)->nlmsg_len - NLMSG_SPACE((len)))