netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shyam saini <mayhs11saini@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, shyam saini <mayhs11saini@gmail.com>
Subject: [Iptables PATCH] extensions: Rename 'flow table' keyword to meter
Date: Sat, 27 Jan 2018 00:11:16 +0530	[thread overview]
Message-ID: <1516992076-10321-1-git-send-email-mayhs11saini@gmail.com> (raw)

After nft v0.8.1 "flow table" is renamed as meter.
This should reflect in iptables to nftables translation.

Before this patch:
$ iptables-translate -A INPUT -m tcp -p tcp --dport 80 -m hashlimit
--hashlimit-above 200/sec --hashlimit-mode srcip,dstport
--hashlimit-name http1 -j DROP

nft add rule ip filter INPUT tcp dport 80 flow table http1 { tcp dport .
ip saddr limit rate over 200/second } counter drop

After this patch:
$ iptables-translate -A INPUT -m tcp -p tcp --dport 80 -m hashlimit
--hashlimit-upto 200 --hashlimit-mode srcip --hashlimit-name http3
--hashlimit-srcmask 24 -j DROP

nft add rule ip filter INPUT tcp dport 80 meter http3 { ip saddr and
255.255.255.0 limit rate 200/second } counter drop

Signed-off-by: shyam saini <mayhs11saini@gmail.com>
---
 extensions/libxt_hashlimit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c
index 3fa5719127db..86234e3d6089 100644
--- a/extensions/libxt_hashlimit.c
+++ b/extensions/libxt_hashlimit.c
@@ -1338,7 +1338,7 @@ static int hashlimit_mt_xlate(struct xt_xlate *xl, const char *name,
 {
 	int ret = 1;
 
-	xt_xlate_add(xl, "flow table %s {", name);
+	xt_xlate_add(xl, "meter %s {", name);
 	ret = hashlimit_mode_xlate(xl, cfg->mode, family,
 				   cfg->srcmask, cfg->dstmask);
 	if (cfg->expire != 1000)
@@ -1367,7 +1367,7 @@ static int hashlimit_xlate(struct xt_xlate *xl,
 	const struct xt_hashlimit_info *info = (const void *)params->match->data;
 	int ret = 1;
 
-	xt_xlate_add(xl, "flow table %s {", info->name);
+	xt_xlate_add(xl, "meter %s {", info->name);
 	ret = hashlimit_mode_xlate(xl, info->cfg.mode, NFPROTO_IPV4, 32, 32);
 	xt_xlate_add(xl, " timeout %us limit rate", info->cfg.expire / 1000);
 	print_packets_rate_xlate(xl, info->cfg.avg, 1);
-- 
1.9.1


             reply	other threads:[~2018-01-26 18:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26 18:41 shyam saini [this message]
2018-01-29 14:25 ` [Iptables PATCH] extensions: Rename 'flow table' keyword to meter 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=1516992076-10321-1-git-send-email-mayhs11saini@gmail.com \
    --to=mayhs11saini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).