summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-10-24 18:05:55 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-24 20:08:24 +0200
commit1a98264ddba1ccb5f27115259c8e8c1dc34948fa (patch)
tree58da6230f377ced08e6a872103f41c78dc839cad
parent841d5f5a3deacfe7b4245df0890849d8e4ad5817 (diff)
mnl: Improve error checking in mnl_nft_event_listener()
When trying to adjust receive buffer size, the second call to setsockopt() was not error-checked. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/mnl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mnl.c b/src/mnl.c
index 2be8ca14..0d9b7ffc 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -1425,8 +1425,11 @@ int mnl_nft_event_listener(struct mnl_socket *nf_sock, unsigned int debug_mask,
*/
ret = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsiz,
sizeof(socklen_t));
- nft_print(octx, "# Cannot set up netlink socket buffer size to %u bytes, falling back to %u bytes\n",
- NFTABLES_NLEVENT_BUFSIZ, bufsiz);
+ if (ret < 0)
+ nft_print(octx, "# Cannot increase netlink socket buffer size, expect message loss\n");
+ else
+ nft_print(octx, "# Cannot set up netlink socket buffer size to %u bytes, falling back to %u bytes\n",
+ NFTABLES_NLEVENT_BUFSIZ, bufsiz);
}
while (1) {