From 2d4cd609f22dc156b5b6e2a5db2d3d11bdb8163d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 17 Dec 2008 18:35:21 +0100 Subject: netlink: log report initial netlink event socket buffer size This patch adds an initial log message to report the initial netlink event socket buffer size. Signed-off-by: Pablo Neira Ayuso --- src/netlink.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/netlink.c') diff --git a/src/netlink.c b/src/netlink.c index 8930e39..4fe0498 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -53,10 +53,10 @@ struct nfct_handle *nl_init_event_handler(void) fcntl(nfct_fd(h), F_SETFL, O_NONBLOCK); /* set up socket buffer size */ - if (CONFIG(netlink_buffer_size)) - nfnl_rcvbufsiz(nfct_nfnlh(h), - CONFIG(netlink_buffer_size)); - else { + if (CONFIG(netlink_buffer_size)) { + CONFIG(netlink_buffer_size) = + nfnl_rcvbufsiz(nfct_nfnlh(h), CONFIG(netlink_buffer_size)); + } else { socklen_t socklen = sizeof(unsigned int); unsigned int read_size; @@ -67,6 +67,9 @@ struct nfct_handle *nl_init_event_handler(void) CONFIG(netlink_buffer_size) = read_size; } + dlog(LOG_NOTICE, "netlink event socket buffer size has been set " + "to %u bytes", CONFIG(netlink_buffer_size)); + /* ensure that maximum grown size is >= than maximum size */ if (CONFIG(netlink_buffer_size_max_grown) < CONFIG(netlink_buffer_size)) CONFIG(netlink_buffer_size_max_grown) = @@ -138,9 +141,8 @@ void nl_resize_socket_buffer(struct nfct_handle *h) CONFIG(netlink_buffer_size) = nfnl_rcvbufsiz(nfct_nfnlh(h), s); /* notify the sysadmin */ - dlog(LOG_NOTICE, "netlink socket buffer size " - "has been set to %u bytes", - CONFIG(netlink_buffer_size)); + dlog(LOG_NOTICE, "netlink socket buffer size has been increased " + "to %u bytes", CONFIG(netlink_buffer_size)); } int nl_dump_conntrack_table(struct nfct_handle *h) -- cgit v1.2.3