From 4eaebf5ef25f97cc6960da9f1a29b61737da8abd Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 21 Oct 2010 12:00:27 +0200 Subject: src: define MNL_SOCKET_BUFFER_SIZE to 8192UL Davem spotted during the Netfilter Workshop that user-space applications should use 8KB buffers for recv(). I accidentally found that NFLOG is not following this approach (in this case we're using 131072 bytes messages), we have to document this. Anyway, according to linux/netlink.h (and to complete this log message): "skb should fit one page. This choice is good for headerless malloc. But we should limit to 8K so that userspace does not have to use enormous buffer sizes on recvmsg() calls just to avoid MSG_TRUNC when PAGE_SIZE is very large." Signed-off-by: Pablo Neira Ayuso --- examples/rtnl/rtnl-route-dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/rtnl/rtnl-route-dump.c') diff --git a/examples/rtnl/rtnl-route-dump.c b/examples/rtnl/rtnl-route-dump.c index 34c95cf..22395c4 100644 --- a/examples/rtnl/rtnl-route-dump.c +++ b/examples/rtnl/rtnl-route-dump.c @@ -199,7 +199,7 @@ static int data_cb(const struct nlmsghdr *nlh, void *data) int main() { struct mnl_socket *nl; - char buf[getpagesize()]; + char buf[MNL_SOCKET_BUFFER_SIZE]; struct nlmsghdr *nlh; struct rtmsg *rtm; int ret; -- cgit v1.2.3