From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: kaber@trash.net
Subject: [PATCH 1/3 nft] src: get rid of EINTR handling in nft_netlink()
Date: Wed, 8 Jul 2015 11:18:06 +0200 [thread overview]
Message-ID: <1436347088-9687-1-git-send-email-pablo@netfilter.org> (raw)
The only remaining caller that needs this is netlink_dump_ruleset(), that is
used to export the ruleset using markup representation. We can remove it and
handle this from do_command_export() now that we have a centralized point to
build up the object cache.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/main.c | 7 -------
src/rule.c | 10 ++++++----
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/src/main.c b/src/main.c
index a069f63..52c1597 100644
--- a/src/main.c
+++ b/src/main.c
@@ -254,14 +254,7 @@ replay:
if (ret != 0 || state->nerrs > 0)
goto err1;
-retry:
ret = nft_netlink(state, msgs);
- if (ret < 0 && errno == EINTR) {
- nft_cache_fini();
- netlink_restart();
- goto retry;
- }
-
err1:
list_for_each_entry_safe(cmd, next, &state->cmds, list) {
list_del(&cmd->list);
diff --git a/src/rule.c b/src/rule.c
index 86e77b6..f806db6 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -899,11 +899,13 @@ static int do_command_delete(struct netlink_ctx *ctx, struct cmd *cmd)
static int do_command_export(struct netlink_ctx *ctx, struct cmd *cmd)
{
- struct nft_ruleset *rs = netlink_dump_ruleset(ctx, &cmd->handle,
- &cmd->location);
+ struct nft_ruleset *rs;
- if (rs == NULL)
- return -1;
+ do {
+ rs = netlink_dump_ruleset(ctx, &cmd->handle, &cmd->location);
+ if (rs == NULL && errno != EINTR)
+ return -1;
+ } while (rs == NULL);
nft_ruleset_fprintf(stdout, rs, cmd->export->format, 0);
fprintf(stdout, "\n");
--
1.7.10.4
next reply other threads:[~2015-07-08 9:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 9:18 Pablo Neira Ayuso [this message]
2015-07-08 9:18 ` [PATCH 2/3 nft] src: fix do_list_tables() with family filtering Pablo Neira Ayuso
2015-07-08 9:18 ` [PATCH 3/3 nft] configure: fix --enable-debug Pablo Neira Ayuso
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=1436347088-9687-1-git-send-email-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
/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).