From: FaTe <gokuvsvegita@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH] libip6t_hbh: Add translation to nft
Date: Wed, 9 Mar 2016 12:42:45 +0530 [thread overview]
Message-ID: <56DFCCED.8040909@gmail.com> (raw)
In-Reply-To: <20160308105346.GB4008@salvia>
Added translation for hbh module .
Note: Currently, --hbh-opts support dont exist in nftables .
Example :
$ ip6tables-translate -A INPUT -m hbh --hbh-len 40
nft add rule ip6 filter INPUT hbh hdrlength 40 counter
$ sudo ip6tables-translate -A INPUT -m hbh ! --hbh-len 40
nft add rule ip6 filter INPUT hbh hdrlength != 40 counter
Signed-off-by: Piyush Pangtey <gokuvsvegita@gmail.com>
---
extensions/libip6t_hbh.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/extensions/libip6t_hbh.c b/extensions/libip6t_hbh.c
index c0389ed..98dcade 100644
--- a/extensions/libip6t_hbh.c
+++ b/extensions/libip6t_hbh.c
@@ -164,6 +164,27 @@ static void hbh_save(const void *ip, const struct xt_entry_match *match)
print_options(optinfo->optsnr, (uint16_t *)optinfo->opts);
}
+static int hbh_xlate(const struct xt_entry_match *match, struct xt_xlate *xl,
+ int numeric)
+{
+ const struct ip6t_opts *optinfo = (struct ip6t_opts *)match->data;
+
+ if (optinfo->flags & IP6T_OPTS_LEN) {
+ xt_xlate_add(xl," hbh hdrlength %s %u",
+ (optinfo->invflags & IP6T_OPTS_INV_LEN) ? " !=" :
+ "", optinfo->hdrlen);
+ } else {
+ return 0;
+ }
+
+ if (optinfo->flags & IP6T_OPTS_OPTS)
+ return 0;
+
+ xt_xlate_add(xl, " ");
+
+ return 1;
+
+}
static struct xtables_match hbh_mt6_reg = {
.name = "hbh",
.version = XTABLES_VERSION,
@@ -175,6 +196,7 @@ static struct xtables_match hbh_mt6_reg = {
.save = hbh_save,
.x6_parse = hbh_parse,
.x6_options = hbh_opts,
+ .xlate = hbh_xlate,
};
void
--
1.9.1
next prev parent reply other threads:[~2016-03-09 7:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 21:21 [PATCHv3] extensions: libipt_icmp: Add translation to nft Laura Garcia Liebana
2016-03-08 10:53 ` Pablo Neira Ayuso
2016-03-09 6:58 ` [PATCH] libxt_multiport: " FaTe
2016-03-09 12:32 ` Pablo Neira Ayuso
2016-03-09 14:37 ` Piyush Pangtey
2016-03-09 14:39 ` [PATCH v2] " Piyush Pangtey
2016-03-09 17:30 ` Pablo Neira Ayuso
2016-03-10 12:50 ` [PATCH v3] " Piyush Pangtey
2016-03-10 18:31 ` Pablo Neira Ayuso
2016-03-09 7:05 ` Regarding libxt_multiport translation in nft FaTe
2016-03-09 10:06 ` Arturo Borrero Gonzalez
2016-03-09 14:34 ` Piyush Pangtey
2016-03-09 7:12 ` FaTe [this message]
2016-03-10 18:47 ` [PATCH] libip6t_hbh: Add translation to nft Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56DFCCED.8040909@gmail.com \
--to=gokuvsvegita@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.