#ifdef HAVE_LIBMNL
#include <libmnl/libmnl.h>
+static inline size_t mnl_buffer_size() {
+ long s = MNL_SOCKET_BUFFER_SIZE;
+ if(s <= 0) return 8192;
+ return (size_t)s;
+}
// ----------------------------------------------------------------------------
// DO_NFSTAT - collect netfilter connection tracker statistics via netlink
static int nfstat_init(int update_every) {
nfstat_root.update_every = update_every;
- nfstat_root.buf_size = (size_t)MNL_SOCKET_BUFFER_SIZE;
+ nfstat_root.buf_size = mnl_buffer_size();
nfstat_root.buf = mallocz(nfstat_root.buf_size);
nfstat_root.mnl = mnl_socket_open(NETLINK_NETFILTER);
static int nfacct_init(int update_every) {
nfacct_root.update_every = update_every;
- nfacct_root.buf_size = (size_t)MNL_SOCKET_BUFFER_SIZE;
+ nfacct_root.buf_size = mnl_buffer_size();
nfacct_root.buf = mallocz(nfacct_root.buf_size);
nfacct_root.nfacct_buffer = nfacct_alloc();
RRDHOST *host = callocz(1, sizeof(RRDHOST));
- host->rrd_update_every = update_every;
+ host->rrd_update_every = (update_every > 0)?update_every:1;
host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries);
host->rrd_memory_mode = memory_mode;
host->health_enabled = (memory_mode == RRD_MEMORY_MODE_NONE)? 0 : health_enabled;