From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Pablo M. Bermudo Garay" <pablombg@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH iptables 2/2] xtables-translate-restore: do not escape quotes
Date: Wed, 17 Aug 2016 16:28:54 +0200 [thread overview]
Message-ID: <20160817142854.GB9755@salvia> (raw)
In-Reply-To: <20160816174433.28272-2-pablombg@gmail.com>
On Tue, Aug 16, 2016 at 07:44:33PM +0200, Pablo M. Bermudo Garay wrote:
> 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
I can see a 'bool restore' in do_command_xlate() provides this
context, you can probably propagate this.
This strcmp() is ugly using the global.
next prev parent reply other threads:[~2016-08-17 14:29 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 ` [PATCH iptables 2/2] xtables-translate-restore: do not escape quotes Pablo M. Bermudo Garay
2016-08-17 14:28 ` Pablo Neira Ayuso [this message]
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=20160817142854.GB9755@salvia \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablombg@gmail.com \
/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.