netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH iptables-nft] extensions: add xt_statistics random mode translation
Date: Thu, 1 Dec 2022 14:14:10 +0100	[thread overview]
Message-ID: <Y4iooljLqMmp1bgn@orbyte.nwl.cc> (raw)
In-Reply-To: <20221201120610.GB7057@breakpoint.cc>

On Thu, Dec 01, 2022 at 01:06:10PM +0100, Florian Westphal wrote:
> Phil Sutter <phil@nwl.cc> wrote:
> > On Thu, Dec 01, 2022 at 11:13:17AM +0100, Florian Westphal wrote:
> > > Use meta random and bitops to replicate what xt_statistics
> > > is doing.
> > 
> > I didn't know about 'meta random', even though it's a bit older than
> > numgen. What's the difference to 'numgen random'?
> 
> META_RANDOM is simpler. its really just setting a 32bit register to a
> 32bit random value.
> 
> No modulus, offset or anything like that is supported.
> 
> For most users, numgen random is much better because you can generate a
> random number within a given range.
> 
> But this translation really does match exactly what xt_statistics is
> doing.

OK, cool!

> > I'm asking because I
> > once tried to fix the same issue using the latter[1], it was never
> > applied, though.
> > 
> > Maybe you could reuse gcd_div() from my patch to reduce nominal values?
> 
> Why?  If you prefer numgen, maybe just rebase your patch and push it out?

No, I don't care whether meta or numgen. I just recall some
probability/mask values would trim down nicely and make things more
readable. Just push your patch please, I'll play with gcd() if time
allows.

Thanks, Phil

      reply	other threads:[~2022-12-01 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 10:13 [PATCH iptables-nft] extensions: add xt_statistics random mode translation Florian Westphal
2022-12-01 11:58 ` Phil Sutter
2022-12-01 12:06   ` Florian Westphal
2022-12-01 13:14     ` Phil Sutter [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=Y4iooljLqMmp1bgn@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=fw@strlen.de \
    --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 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).