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 -- 2.21.0