summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShivani Bhardwaj <shivanib134@gmail.com>2015-12-23 15:38:40 +0530
committerPablo Neira Ayuso <pablo@netfilter.org>2016-02-16 19:30:22 +0100
commit4eb2c9ca79fb38352b3de500f9eb10f1578ef83f (patch)
tree5b1a451a424de31d8435c991e14374b67ede9887
parent509619a03a1757073c6ec9af6164fd6c46f8599c (diff)
extensions: libxt_helper: Add translation to nft
Add translation for helper module to nftables. Examples: $ sudo iptables-translate -A FORWARD -m helper --helper sip nft add rule ip filter FORWARD ct helper \"sip\" counter $ sudo iptables-translate -A FORWARD -m helper ! --helper ftp nft add rule ip filter FORWARD ct helper != \"ftp\" counter Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--extensions/libxt_helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/extensions/libxt_helper.c b/extensions/libxt_helper.c
index c9f9435e..971ce4ab 100644
--- a/extensions/libxt_helper.c
+++ b/extensions/libxt_helper.c
@@ -45,6 +45,17 @@ static void helper_save(const void *ip, const struct xt_entry_match *match)
xtables_save_string(info->name);
}
+static int helper_xlate(const struct xt_entry_match *match,
+ struct xt_buf *buf, int numeric)
+{
+ const struct xt_helper_info *info = (const void *)match->data;
+
+ xt_buf_add(buf, "ct helper%s \\\"%s\\\" ",
+ info->invert ? " !=" : "", info->name);
+
+ return 1;
+}
+
static struct xtables_match helper_match = {
.family = NFPROTO_UNSPEC,
.name = "helper",
@@ -55,6 +66,7 @@ static struct xtables_match helper_match = {
.save = helper_save,
.x6_parse = helper_parse,
.x6_options = helper_opts,
+ .xlate = helper_xlate,
};
void _init(void)