]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: hashlimit: Rename 'flow table' keyword to meter
authorshyam saini <mayhs11saini@gmail.com>
Fri, 26 Jan 2018 18:41:16 +0000 (00:11 +0530)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 29 Jan 2018 14:23:10 +0000 (15:23 +0100)
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
extensions/libxt_hashlimit.c
extensions/libxt_hashlimit.txlate

index 3fa5719127db9d15828bfe72085d20bfa4210f7a..86234e3d6089fe50da694988e5f490a5ff053d82 100644 (file)
@@ -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);
index d8fa8d2338f082f90d608ca998af4b37def9bd4b..6c8d07f113d26e9ad3067941e7abe8503ffbce8c 100644 (file)
@@ -1,5 +1,5 @@
 iptables-translate -A OUTPUT -m tcp -p tcp --dport 443 -m hashlimit --hashlimit-above 20kb/s --hashlimit-burst 1mb --hashlimit-mode dstip --hashlimit-name https --hashlimit-dstmask 24 -m state --state NEW -j DROP
-nft add rule ip filter OUTPUT tcp dport 443 flow table https { ip daddr and 255.255.255.0 timeout 60s limit rate over 20 kbytes/second burst 1 mbytes} ct state new  counter drop
+nft add rule ip filter OUTPUT tcp dport 443 meter https { ip daddr and 255.255.255.0 timeout 60s limit rate over 20 kbytes/second burst 1 mbytes} ct state new  counter drop
 
 iptables-translate -A OUTPUT -m tcp -p tcp --dport 443 -m hashlimit --hashlimit-upto 300 --hashlimit-burst 15 --hashlimit-mode srcip,dstip --hashlimit-name https --hashlimit-htable-expire 300000 -m state --state NEW -j DROP
-nft add rule ip filter OUTPUT tcp dport 443 flow table https { ip daddr . ip saddr timeout 300s limit rate 300/second burst 15 packets} ct state new  counter drop
+nft add rule ip filter OUTPUT tcp dport 443 meter https { ip daddr . ip saddr timeout 300s limit rate 300/second burst 15 packets} ct state new  counter drop