aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/socket.h
diff options
context:
space:
mode:
authorGu Zheng <guz.fnst@cn.fujitsu.com>2014-12-11 11:22:04 +0800
committerDavid S. Miller <davem@davemloft.net>2014-12-10 22:41:55 -0500
commitf95b414edb18de59940dcebbefb49cf25c6d505c (patch)
tree654de508641fd2c82428f43387b72fd1a3dcef42 /include/linux/socket.h
parentcxgb4/cxgb4vf: global named must be unique (diff)
downloadwireguard-linux-f95b414edb18de59940dcebbefb49cf25c6d505c.tar.xz
wireguard-linux-f95b414edb18de59940dcebbefb49cf25c6d505c.zip
net: introduce helper macro for_each_cmsghdr
Introduce helper macro for_each_cmsghdr as a wrapper of the enumerating cmsghdr from msghdr, just cleanup. Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/socket.h')
-rw-r--r--include/linux/socket.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 048d6d6eed6d..6e49a14365dc 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -103,6 +103,10 @@ struct cmsghdr {
(cmsg)->cmsg_len <= (unsigned long) \
((mhdr)->msg_controllen - \
((char *)(cmsg) - (char *)(mhdr)->msg_control)))
+#define for_each_cmsghdr(cmsg, msg) \
+ for (cmsg = CMSG_FIRSTHDR(msg); \
+ cmsg; \
+ cmsg = CMSG_NXTHDR(msg, cmsg))
/*
* Get the next cmsg header