From dbd6621f3fa25dfa8c7c77c52a19cb0c1bd81642 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 29 May 2019 20:40:39 +0200 Subject: mnl: mnl_batch_talk() returns -1 on internal netlink errors Display an error in case internal netlink plumbing hits problems. Signed-off-by: Pablo Neira Ayuso --- src/libnftables.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/libnftables.c') diff --git a/src/libnftables.c b/src/libnftables.c index a58b8ca9..d8de89ca 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -58,6 +58,14 @@ static int nft_netlink(struct nft_ctx *nft, goto out; ret = mnl_batch_talk(&ctx, &err_list, num_cmds); + if (ret < 0) { + netlink_io_error(&ctx, NULL, + "Could not process rule: %s", strerror(errno)); + goto out; + } + + if (!list_empty(&err_list)) + ret = -1; list_for_each_entry_safe(err, tmp, &err_list, head) { list_for_each_entry(cmd, cmds, list) { -- cgit v1.2.3