From: Thomas Woerner <twoerner@redhat.com>
To: netfilter-devel@vger.kernel.org
Cc: Thomas Woerner <twoerner@redhat.com>
Subject: [IPTABLES 1/2] iptables-compat: Allow to insert into rule_count+1 position
Date: Tue, 21 Jul 2015 15:45:41 +0200 [thread overview]
Message-ID: <1437486342-6917-2-git-send-email-twoerner@redhat.com> (raw)
In-Reply-To: <1437486342-6917-1-git-send-email-twoerner@redhat.com>
iptables allows to insert a rule into the next non existing rule number but
iptables-compat does not allow to do this
Signed-off-by: Thomas Woerner <twoerner@redhat.com>
---
:100644 100644 7cd56ef... 323f124... M iptables/nft.c
iptables/nft.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/iptables/nft.c b/iptables/nft.c
index 7cd56ef..323f124 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1854,6 +1854,16 @@ int nft_rule_insert(struct nft_handle *h, const char *chain,
r = nft_rule_find(h, list, chain, table, data, rulenum);
if (r == NULL) {
+ /* special case: iptables allows to insert into
+ rule_count+1 position */
+ r = nft_rule_find(h, list, chain, table, data,
+ rulenum-1);
+ if (r != NULL) {
+ nft_rule_list_destroy(list);
+ return nft_rule_append(h, chain, table, data,
+ 0, verbose);
+ }
+
errno = ENOENT;
goto err;
}
--
2.4.3
next prev parent reply other threads:[~2015-07-21 13:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 13:45 [IPTABLES 0/2] iptables-compat fixes Thomas Woerner
2015-07-21 13:45 ` Thomas Woerner [this message]
2015-07-21 13:45 ` [IPTABLES 2/2] iptables-compat: Increase rule number only for the selected table and chain Thomas Woerner
2015-07-23 14:58 ` [IPTABLES 0/2] iptables-compat fixes 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=1437486342-6917-2-git-send-email-twoerner@redhat.com \
--to=twoerner@redhat.com \
--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).