From 03ecffe6c2cc0c71f5ece161d39368d56930e241 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Wed, 11 Apr 2018 10:24:37 +0200 Subject: ebtables-compat: add initial translations add translations for ip, limit, log, mark, mark_m, nflog. Signed-off-by: Florian Westphal --- extensions/libebt_nflog.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'extensions/libebt_nflog.c') diff --git a/extensions/libebt_nflog.c b/extensions/libebt_nflog.c index 5f1d13b1..57f09291 100644 --- a/extensions/libebt_nflog.c +++ b/extensions/libebt_nflog.c @@ -124,6 +124,30 @@ brnflog_print(const void *ip, const struct xt_entry_target *target, printf("--nflog-threshold %d ", info->threshold); } +static int brnflog_xlate(struct xt_xlate *xl, + const struct xt_xlate_tg_params *params) +{ + const struct ebt_nflog_info *info = (void *)params->target->data; + + xt_xlate_add(xl, "log "); + if (info->prefix[0] != '\0') { + if (params->escape_quotes) + xt_xlate_add(xl, "prefix \\\"%s\\\" ", info->prefix); + else + xt_xlate_add(xl, "prefix \"%s\" ", info->prefix); + + } + + xt_xlate_add(xl, "group %u ", info->group); + + if (info->len) + xt_xlate_add(xl, "snaplen %u ", info->len); + if (info->threshold != EBT_NFLOG_DEFAULT_THRESHOLD) + xt_xlate_add(xl, "queue-threshold %u ", info->threshold); + + return 1; +} + static struct xtables_target brnflog_watcher = { .name = "nflog", .revision = 0, @@ -135,6 +159,7 @@ static struct xtables_target brnflog_watcher = { .help = brnflog_help, .parse = brnflog_parse, .print = brnflog_print, + .xlate = brnflog_xlate, .extra_opts = brnflog_opts, }; -- cgit v1.2.3