From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [iptables PATCH] extensions: libxt_conntrack: Fix 'state' translation to nft
Date: Tue, 7 Mar 2017 16:35:07 +0100 [thread overview]
Message-ID: <20170307153507.14640-1-phil@nwl.cc> (raw)
While translating a conntrack state match in old syntax, matches are
looked up by name, only. This returned the revision 0 entry since
matches are registered in reverse order of appearance in the array
passed to xtables_register_matches(). The problem is that revision 0
doesn't define an xlate callback.
Fix this by reordering the matches in conntrack_mt_reg so that the
highest revision one is found first.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
The strange thing here is that I'm pretty sure this has been working
once. My logs from playing with iptables-restore-translate from November
2016 indicate that. Yet I have not been able to find a point in iptables
git history in which it works.
---
extensions/libxt_conntrack.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/extensions/libxt_conntrack.c b/extensions/libxt_conntrack.c
index 72c522004a7ea..60ce9d1dc0a2e 100644
--- a/extensions/libxt_conntrack.c
+++ b/extensions/libxt_conntrack.c
@@ -1507,6 +1507,19 @@ static struct xtables_match conntrack_mt_reg[] = {
{
.family = NFPROTO_UNSPEC,
.name = "state",
+ .revision = 0,
+ .version = XTABLES_VERSION,
+ .size = XT_ALIGN(sizeof(struct xt_state_info)),
+ .userspacesize = XT_ALIGN(sizeof(struct xt_state_info)),
+ .help = state_help,
+ .print = state_print,
+ .save = state_save,
+ .x6_parse = state_parse,
+ .x6_options = state_opts,
+ },
+ {
+ .family = NFPROTO_UNSPEC,
+ .name = "state",
.real_name = "conntrack",
.revision = 1,
.ext_flags = XTABLES_EXT_ALIAS,
@@ -1550,19 +1563,6 @@ static struct xtables_match conntrack_mt_reg[] = {
.x6_options = state_opts,
.xlate = state_xlate,
},
- {
- .family = NFPROTO_UNSPEC,
- .name = "state",
- .revision = 0,
- .version = XTABLES_VERSION,
- .size = XT_ALIGN(sizeof(struct xt_state_info)),
- .userspacesize = XT_ALIGN(sizeof(struct xt_state_info)),
- .help = state_help,
- .print = state_print,
- .save = state_save,
- .x6_parse = state_parse,
- .x6_options = state_opts,
- },
};
void _init(void)
--
2.11.0
next reply other threads:[~2017-03-07 15:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 15:35 Phil Sutter [this message]
2017-03-07 16:17 ` [iptables PATCH] extensions: libxt_conntrack: Fix 'state' translation to nft Pablo Neira Ayuso
2017-03-07 16:20 ` Pablo Neira Ayuso
2017-03-07 16:54 ` Phil Sutter
2017-03-07 19:31 ` Pablo Neira Ayuso
2017-03-07 20:07 ` Phil Sutter
2017-03-08 10:36 ` Pablo Neira Ayuso
2017-03-08 12:31 ` Phil Sutter
2017-03-08 13:38 ` Pablo Neira Ayuso
2017-03-08 14:03 ` Phil Sutter
2017-03-08 15:43 ` [iptables PATCH] xtables-translate: Avoid querying the kernel Phil Sutter
2017-03-08 15:45 ` Pablo Neira Ayuso
2017-03-08 14:02 ` [iptables PATCH] extensions: libxt_conntrack: Fix 'state' translation to nft Phil Sutter
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=20170307153507.14640-1-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).