diff options
author | Florian Westphal <fw@strlen.de> | 2018-04-11 10:24:37 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-04-11 10:51:46 +0200 |
commit | 03ecffe6c2cc0c71f5ece161d39368d56930e241 (patch) | |
tree | 1c6ab0aacf902c707004b27000a5a586df6ba3b0 /extensions/libebt_nflog.c | |
parent | 57af67de905c9f68b9f011b9a7cfcff12ada8012 (diff) |
ebtables-compat: add initial translations
add translations for ip, limit, log, mark, mark_m, nflog.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'extensions/libebt_nflog.c')
-rw-r--r-- | extensions/libebt_nflog.c | 25 |
1 files changed, 25 insertions, 0 deletions
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, }; |