From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH iptables] extensions: hashlimit: fix incorrect burst in translations
Date: Wed, 3 Jan 2018 15:41:08 +0100 [thread overview]
Message-ID: <20180103144109.8280-1-pablo@netfilter.org> (raw)
iptables-translate -A INPUT -m tcp -p tcp --dport 80 -m hashlimit --hashlimit-above 200kb/s --hashlimit-burst 1mb --hashlimit-mode srcip,dstport --hashlimit-name http2 --hashlimit-htable-expire 3000 -j DROP
shows:
nft add rule ip filter INPUT tcp dport 80 flow table http2 { tcp dport . ip saddr timeout 3s limit rate over 200 kbytes/second burst 1 mbytes burst 6 packets} counter drop
which prints burst twice, this is not correct.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
extensions/libxt_hashlimit.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/extensions/libxt_hashlimit.c b/extensions/libxt_hashlimit.c
index 472d8e7f6cc2..3fa5719127db 100644
--- a/extensions/libxt_hashlimit.c
+++ b/extensions/libxt_hashlimit.c
@@ -1350,10 +1350,12 @@ static int hashlimit_mt_xlate(struct xt_xlate *xl, const char *name,
if (cfg->mode & XT_HASHLIMIT_BYTES)
print_bytes_rate_xlate(xl, cfg);
- else
+ else {
print_packets_rate_xlate(xl, cfg->avg, revision);
- if (cfg->burst != 5)
- xt_xlate_add(xl, " burst %lu packets", cfg->burst);
+ if (cfg->burst != XT_HASHLIMIT_BURST)
+ xt_xlate_add(xl, " burst %lu packets", cfg->burst);
+
+ }
xt_xlate_add(xl, "}");
return ret;
--
2.11.0
next reply other threads:[~2018-01-03 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 14:41 Pablo Neira Ayuso [this message]
2018-01-03 22:26 ` [PATCH iptables] extensions: hashlimit: fix incorrect burst in translations Duncan Roe
2018-01-03 22:59 ` And another thing Duncan Roe
2018-01-04 9:53 ` [PATCH iptables] extensions: hashlimit: fix incorrect burst in translations Pablo Neira Ayuso
2018-01-04 10:56 ` Duncan Roe
-- strict thread matches above, loose matches on Subject: below --
2018-01-04 22:05 Duncan Roe
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=20180103144109.8280-1-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.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.