Netlink buffers
Alessandro Vesely <[email protected]> Sat, 27 Dec 2025 13:10:14 +0100
| Newsgroups | gmane.comp.security.firewalls.netfilter.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have two problems on this subject.
One is with ulogd2. I'm using the Debian stable version. It has parameters netlink_socket_buffer_size and netlink_socket_buffer_maxsize. On ENOBUFS, it does so:
if (nlsockbufmaxsize_ce(upi->config_kset).u.value) {
int s = cpi->nlbufsiz * 2;
if (setnlbufsiz(upi, s)) {
ulogd_log(ULOGD_NOTICE,
"We are losing events, "
"increasing buffer size "
"to %d\n", cpi->nlbufsiz);
The log it produces is like the following:
Dec 25 04:44:46 29 north ulogd[21274]: We are losing events, increasing buffer size to 425984
Dec 25 04:45:25 29 north ulogd[21274]: We are losing events, increasing buffer size to 425984
Dec 25 04:46:08 29 north ulogd[21274]: We are losing events, increasing buffer size to 425984
Dec 25 04:46:49 29 north ulogd[21274]: We are losing events, increasing buffer size to 425984
Dec 25 04:47:28 29 north ulogd[21274]: We are losing events, increasing buffer size to 425984
Dec 25 04:48:11 29 north ulogd[21274]: We are losing events, increasing buffer size to 425984
...
The setnlbufsiz() function is supposed to alter the buffer size by executing this:
cpi->nlbufsiz = nfnl_rcvbufsiz(nfct_nfnlh(cpi->cth), size);
This function should set the new size of the socket buffer and return it. Obviously, the size is never doubled.
Is there a newer version of ulogd2?
The second problem is similar. A custom filter using libmnl reports ENOBUF about once every two days, during the cron.daily process. I haven't figured out what's causing it yet. However, I don't know how to increase the socket buffer if necessary. The previous version (which didn't use libmnl) called setsockopt() with SO_RCVBUF, but mnl_socket_setsockopt() doesn't appear to have such an option.
Any hint?
Best
Ale
--