netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: pablombg@gmail.com
Subject: [PATCH nft] netlink: don't bail out on dump errors
Date: Thu, 19 Jan 2017 17:52:55 +0100	[thread overview]
Message-ID: <1484844775-6691-1-git-send-email-pablo@netfilter.org> (raw)

This patch removes the existing error messages on netlink dump errors.
These functions used to be called from list commands. These days they
are called from the cache cache population path.

Note that nft breaks with older kernels at netlink_list_objs() since we
have no stateful objects support there.

Silence errors at this stage and return an empty list, thus, nft bails
out on explicit user commands if no nf_tables support is available.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
Please, give it a test and let me know if this fixes the problem for you, thanks!

 src/netlink.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/netlink.c b/src/netlink.c
index 4135f2517a09..73ee5c973d16 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -551,9 +551,7 @@ static int netlink_list_rules(struct netlink_ctx *ctx, const struct handle *h,
 		if (errno == EINTR)
 			return -1;
 
-		return netlink_io_error(ctx, loc,
-					"Could not receive rules from kernel: %s",
-					strerror(errno));
+		return 0;
 	}
 
 	ctx->data = h;
@@ -827,9 +825,7 @@ int netlink_list_chains(struct netlink_ctx *ctx, const struct handle *h,
 		if (errno == EINTR)
 			return -1;
 
-		return netlink_io_error(ctx, loc,
-					"Could not receive chains from kernel: %s",
-					strerror(errno));
+		return 0;
 	}
 
 	ctx->data = h;
@@ -1029,9 +1025,7 @@ int netlink_list_tables(struct netlink_ctx *ctx, const struct handle *h,
 		if (errno == EINTR)
 			return -1;
 
-		return netlink_io_error(ctx, loc,
-					"Could not receive tables from kernel: %s",
-					strerror(errno));
+		return 0;
 	}
 
 	nftnl_table_list_foreach(table_cache, list_table_cb, ctx);
@@ -1331,9 +1325,7 @@ int netlink_list_sets(struct netlink_ctx *ctx, const struct handle *h,
 		if (errno == EINTR)
 			return -1;
 
-		return netlink_io_error(ctx, loc,
-					"Could not receive sets from kernel: %s",
-					strerror(errno));
+		return 0;
 	}
 
 	err = nftnl_set_list_foreach(set_cache, list_set_cb, ctx);
@@ -1789,9 +1781,7 @@ int netlink_list_objs(struct netlink_ctx *ctx, const struct handle *h,
 		if (errno == EINTR)
 			return -1;
 
-		return netlink_io_error(ctx, loc,
-					"Could not receive stateful objects from kernel: %s",
-					strerror(errno));
+		return 0;
 	}
 
 	err = nftnl_obj_list_foreach(obj_cache, list_obj_cb, ctx);
-- 
2.1.4


                 reply	other threads:[~2017-01-19 16:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1484844775-6691-1-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablombg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).