From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: phil@nwl.cc, fw@strlen.de
Subject: [PATCH iptables 4/6] nft: don't care about previous state in ERESTART
Date: Mon, 20 May 2019 21:08:20 +0200 [thread overview]
Message-ID: <20190520190822.18873-5-pablo@netfilter.org> (raw)
In-Reply-To: <20190520190822.18873-1-pablo@netfilter.org>
We need to re-evalute based on the existing cache generation.
Fixes: 58d7de0181f6 ("xtables: handle concurrent ruleset modifications")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
iptables/nft.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/iptables/nft.c b/iptables/nft.c
index 43b9153c2d58..f6d407029892 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -2789,9 +2789,9 @@ static void nft_refresh_transaction(struct nft_handle *h)
if (!tablename)
continue;
exists = nft_table_find(h, tablename);
- if (n->skip && exists)
+ if (exists)
n->skip = 0;
- else if (!n->skip && !exists)
+ else
n->skip = 1;
break;
case NFT_COMPAT_CHAIN_USER_ADD:
@@ -2803,13 +2803,16 @@ static void nft_refresh_transaction(struct nft_handle *h)
if (!chainname)
continue;
+ if (!h->noflush)
+ break;
+
c = nft_chain_find(h, tablename, chainname);
- if (c && !n->skip) {
+ if (c) {
/* -restore -n flushes existing rules from redefined user-chain */
- if (h->noflush)
- __nft_rule_flush(h, tablename,
- chainname, false, true);
- } else if (!c && n->skip) {
+ __nft_rule_flush(h, tablename,
+ chainname, false, true);
+ n->skip = 1;
+ } else if (!c) {
n->skip = 0;
}
break;
--
2.11.0
next prev parent reply other threads:[~2019-05-20 19:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 19:08 [PATCH iptables 0/6] ERESTART fixes Pablo Neira Ayuso
2019-05-20 19:08 ` [PATCH iptables 1/6] nft: keep original cache in case of ERESTART Pablo Neira Ayuso
2019-05-20 19:08 ` [PATCH iptables 2/6] xtables: Fix for explicit rule flushes Pablo Neira Ayuso
2019-05-20 19:08 ` [PATCH iptables 3/6] nft: don't skip table addition from ERESTART Pablo Neira Ayuso
2019-05-20 19:08 ` Pablo Neira Ayuso [this message]
2019-05-20 19:08 ` [PATCH iptables 5/6] nft: do not retry on EINTR Pablo Neira Ayuso
2019-05-20 19:08 ` [PATCH iptables 6/6] nft: reset netlink sender buffer size of socket restart 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=20190520190822.18873-5-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.