From: "Pablo M. Bermudo Garay" <pablombg@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: "Pablo M. Bermudo Garay" <pablombg@gmail.com>
Subject: [PATCH iptables 2/2] xtables-translate-restore: do not escape quotes
Date: Tue, 16 Aug 2016 19:44:33 +0200 [thread overview]
Message-ID: <20160816174433.28272-2-pablombg@gmail.com> (raw)
In-Reply-To: <20160816174433.28272-1-pablombg@gmail.com>
If quotes are escaped, nft -f is unable to parse and load the translated
ruleset.
Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com>
---
iptables/xtables-translate.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index 3c577ed..914d3b1 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -72,6 +72,11 @@ int xlate_action(const struct iptables_command_state *cs, bool goto_set,
.numeric = numeric,
.escape_quotes = true,
};
+ if (!strcmp(xtables_globals.program_name,
+ "iptables-translate-restore") ||
+ !strcmp(xtables_globals.program_name,
+ "ip6tables-translate-restore"))
+ params.escape_quotes = false;
ret = cs->target->xlate(xl, ¶ms);
}
else
@@ -100,6 +105,12 @@ int xlate_matches(const struct iptables_command_state *cs, struct xt_xlate *xl)
.escape_quotes = true,
};
+ if (!strcmp(xtables_globals.program_name,
+ "iptables-translate-restore") ||
+ !strcmp(xtables_globals.program_name,
+ "ip6tables-translate-restore"))
+ params.escape_quotes = false;
+
if (!matchp->match->xlate)
return 0;
--
2.9.3
next prev parent reply other threads:[~2016-08-16 17:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-16 17:44 [PATCH iptables 1/2] xtables-translate: add escape_quotes option to comment_xlate Pablo M. Bermudo Garay
2016-08-16 17:44 ` Pablo M. Bermudo Garay [this message]
2016-08-17 14:28 ` [PATCH iptables 2/2] xtables-translate-restore: do not escape quotes Pablo Neira Ayuso
2016-08-17 14:23 ` [PATCH iptables 1/2] xtables-translate: add escape_quotes option to comment_xlate Pablo Neira Ayuso
2016-08-18 15:59 ` Pablo M. Bermudo Garay
2016-08-18 16:10 ` 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=20160816174433.28272-2-pablombg@gmail.com \
--to=pablombg@gmail.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).