Skip to content

Fix ENOBUFS error in large transactions with --echo

Phil Sutter netfilter-devel 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 5 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4mnl: Maximize socket receive buffer by defaultsrc/mnl.c+21 -200 replies
2/4mnl: Increase receive buffer in mnl_batch_talk()src/mnl.c+1 -12 replies
3/4mnl: Fix and simplify mnl_batch_talk()src/mnl.c+22 -171 reply
4/4tests/shell: Test large transaction with echo outputtests/shell/testcases/transactions/0049huge_0+14 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [nft PATCH 0/4] Fix ENOBUFS error in large transactions with --echo

When committing a larger transaction (e.g. adding 300 rules) with echo output turned on, mnl_batch_talk() would report ENOBUFS after the first call to mnl_socket_recvfrom(). (ENOBUFS indicates congestion in netlink socket.)

The problem in mnl_batch_talk() was a combination of unmodified socket recv buffer, use of select() and unhandled ENOBUFS condition (abort instead of retry).

This series solves the issue, admittedly a bit in sledge hammer method:
Maximize nf_sock receive buffer size for all users, make mnl_batch_talk() fetch more messages at once and retry upon ENOBUFS instead of just giving up.

There was also a problem with select() use which motivated the loop rewrite in Patch 3. Actually, replacing the whole loop by a simple call to nft_mnl_recv() worked and was even sufficient in avoiding ENOBUFS condition, but I am not sure if that has other side-effects.

Phil Sutter (4):
mnl: Maximize socket receive buffer by default
mnl: Increase receive buffer in mnl_batch_talk()
mnl: Fix and simplify mnl_batch_talk() tests/shell: Test large transaction with echo output

 src/mnl.c                                     | 82 ++++++++++---------
 tests/shell/testcases/transactions/0049huge_0 | 14 ++++
 2 files changed, 58 insertions(+), 38 deletions(-)
 create mode 100755 tests/shell/testcases/transactions/0049huge_0
Signature · 1 line
2.21.0