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 &&
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(ipt_log_xlate_names); ++i)
if (loginfo->level != LOG_DEFAULT_LEVEL &&
}
static void nflog_print_xlate(const struct xt_nflog_info *info,
- struct xt_xlate *xl)
+ struct xt_xlate *xl, bool escape_quotes)
{
xt_xlate_add(xl, "log ");
- if (info->prefix[0] != '\0')
- xt_xlate_add(xl, "prefix \\\"%s\\\" ", info->prefix);
+ if (info->prefix[0] != '\0') {
+ if (escape_quotes)
+ xt_xlate_add(xl, "prefix \\\"%s\\\" ", info->prefix);
+ else
+ xt_xlate_add(xl, "prefix \"%s\" ", info->prefix);
+
+ }
if (info->flags & XT_NFLOG_F_COPY_LEN)
xt_xlate_add(xl, "snaplen %u ", info->len);
if (info->threshold != XT_NFLOG_DEFAULT_THRESHOLD)
const struct xt_nflog_info *info =
(struct xt_nflog_info *)params->target->data;
- nflog_print_xlate(info, xl);
+ nflog_print_xlate(info, xl, params->escape_quotes);
return 1;
}
{
const struct xt_helper_info *info = (const void *)params->match->data;
- xt_xlate_add(xl, "ct helper%s \\\"%s\\\"",
- info->invert ? " !=" : "", info->name);
+ if (params->escape_quotes)
+ xt_xlate_add(xl, "ct helper%s \\\"%s\\\"",
+ info->invert ? " !=" : "", info->name);
+ else
+ xt_xlate_add(xl, "ct helper%s \"%s\"",
+ info->invert ? " !=" : "", info->name);
return 1;
}
const void *ip;
const struct xt_entry_match *match;
int numeric;
+ bool escape_quotes;
};
struct xt_xlate_tg_params {
const void *ip;
const struct xt_entry_target *target;
int numeric;
+ bool escape_quotes;
};
/* Include file for additions: new matches and targets. */
.ip = (const void *)&cs->fw,
.target = cs->target->t,
.numeric = numeric,
+ .escape_quotes = true,
};
ret = cs->target->xlate(xl, ¶ms);
}
.ip = (const void *)&cs->fw,
.match = matchp->match->m,
.numeric = numeric,
+ .escape_quotes = true,
};
if (!matchp->match->xlate)