Skip to contentSkip to conversation

extensions: Rename 'flow table' keyword to meter

PATCH Applied shyam saini 2 participants 2 messages Jan 26, 2018 – Jan 29, 2018 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extensions: Rename 'flow table' keyword to meter

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

---
 extensions/libxt_hashlimit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
extensions/libxt_hashlimit.c +2 -2
index 3fa5719127db..86234e3d6089 100644
@@ -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);
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 11 lines · shyam saini

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

Quoted 7 lines

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

Applied, thanks Shyam.