From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Alban Browaeys <alban.browaeys@gmail.com>
Cc: Patrick McHardy <kaber@trash.net>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
"David S. Miller" <davem@davemloft.net>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] netfilter: xt_hashlimit: Fix integer divide round to zero.
Date: Tue, 21 Feb 2017 13:48:39 +0100 [thread overview]
Message-ID: <20170221124839.GA3738@salvia> (raw)
In-Reply-To: <20170206225033.26231-1-alban.browaeys@gmail.com>
On Mon, Feb 06, 2017 at 11:50:33PM +0100, Alban Browaeys wrote:
> Diving the divider by the multiplier before applying to the input.
> When this would "divide by zero", divide the multiplier by the divider
> first then multiply the input by this value.
>
> Currently user2creds outputs zero when input value is bigger than the
> number of slices and lower than scale.
> This as then user input is applied an integer divide operation to
> a number greater than itself (scale).
> That rounds up to zero, then we mulitply zero by the credits slice size.
> iptables -t filter -I INPUT --protocol tcp --match hashlimit
> --hashlimit 40/second --hashlimit-burst 20 --hashlimit-mode srcip
> --hashlimit-name syn-flood --jump RETURN
> thus trigger the overflow detection code:
> xt_hashlimit: overflow, try lower: 25000/20
> (25000 as hashlimit avd and 20 the burst)
> Here:
> 134217 slices of (HZ * CREDITS_PER_JIFFY) size.
> 500000 is user input value
> 1000000 is XT_HASHLIMIT_SCALE_v2
> gives: 0 as user2creds output
> Setting burst to "1" typically solve the issue ...
> but setting it to "40" does too !
>
> This is on 32bit arch calling into revision 2 of hashlimit.
Applied to nf.git, thanks.
prev parent reply other threads:[~2017-02-21 12:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-04 22:47 [PATCH] netfilter: xt_hashlimit: Fix integer divide round to zero Alban Browaeys
2017-02-06 13:04 ` Pablo Neira Ayuso
2017-02-06 14:28 ` Alban Browaeys
2017-02-06 22:50 ` [PATCH v2] " Alban Browaeys
2017-02-21 12:48 ` Pablo Neira Ayuso [this message]
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=20170221124839.GA3738@salvia \
--to=pablo@netfilter.org \
--cc=alban.browaeys@gmail.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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.