summaryrefslogtreecommitdiffstats
path: root/extensions/libip6t_LOG.c
diff options
context:
space:
mode:
authorPablo M. Bermudo Garay <pablombg@gmail.com>2016-07-26 18:45:24 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-07-27 13:56:51 +0200
commit68c57e809f69108694cce2d502a3ed1c328d13e8 (patch)
tree862c9d4e3cc4a15d9f800d98f9757eaea694a255 /extensions/libip6t_LOG.c
parent6604bc6131bf059bce458040ed6b93bcd37fb635 (diff)
xtables-translate: fix issue with quotes
Some translations included escaped quotes when they were called from nft: $ sudo nft list ruleset table ip mangle { chain FORWARD { type filter hook forward priority -150; policy accept; ct helper \"ftp\" counter packets 0 bytes 0 ^^ ^^ } } This behavior is only correct when xlate functions are called from a xtables-translate command. This patch solves that issue using a new parameter (escape_quotes) in the xlate functions. Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'extensions/libip6t_LOG.c')
-rw-r--r--extensions/libip6t_LOG.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c
index cf5f8df5..af77b9a5 100644
--- a/extensions/libip6t_LOG.c
+++ b/extensions/libip6t_LOG.c
@@ -190,8 +190,12 @@ static int LOG_xlate(struct xt_xlate *xl,
unsigned int i = 0;
xt_xlate_add(xl, "log ");
- if (strcmp(loginfo->prefix, "") != 0)
- xt_xlate_add(xl, "prefix \\\"%s\\\" ", loginfo->prefix);
+ if (strcmp(loginfo->prefix, "") != 0) {
+ if (params->escape_quotes)
+ xt_xlate_add(xl, "prefix \\\"%s\\\" ", loginfo->prefix);
+ else
+ xt_xlate_add(xl, "prefix \"%s\" ", loginfo->prefix);
+ }
for (i = 0; i < ARRAY_SIZE(ip6t_log_xlate_names); ++i)
if (loginfo->level == ip6t_log_xlate_names[i].level &&