From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>,
Patrick McHardy <kaber@trash.net>,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 2/3] meta: add prandom matching
Date: Tue, 16 Feb 2016 13:00:24 +0100 [thread overview]
Message-ID: <20160216120024.GB13417@breakpoint.cc> (raw)
In-Reply-To: <20160216114523.GA2502@salvia>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Mon, Feb 15, 2016 at 01:54:46PM +0100, Florian Westphal wrote:
> > Patrick McHardy <kaber@trash.net> wrote:
> >
> > Hi Patrick
> >
> > > On 04.02, Florian Westphal wrote:
> > > > In fact, doing the scaling via precision_type seems to
> > > > be a lot simpler as then its applied only in this one case of the
> > > > prandom META_TEMPLATE while keeping this detail limited to meta.c.
> > >
> > > Yes, on second thought I agree, sorry. Maybe the work is not lost though,
> > > what does seem to make sense is to use a float basetype and derive your
> > > probability type from that.
> >
> > I can do this.
> > However, I don't currently see any other type that could be derived from
> > that. Would you be OK with leaving things as-is and adding a float
> > type later on once a use case presents itself?
>
> I also think you can add a new TYPE_FLOAT.
Yes, but what I'm asking is: 'What for'?
> Then, from the evaluation step make sure that META_PRANDOM is under
> the valid limits (0, 1].
Thats not so simple. META_PRANDOM is scaled so its represented
as 1.0 == UINT32_MAX and 0 = 0.
We can't do that for TYPE_FLOAT since it means that it could not
represent values > 1.0 .
Doing the scaling in the eval step is possible but its a bit ugly.
> These TYPE_* will be part of the public API of the high level library
> at some point, they describe the datatype that are used in set
> definitions in the kernel (through the NFTA_SET_DATATYPE netlink
> attribute and the new NFTA_SET_USERDATA through TLVs).
I understand, but, the proposed float and probability types
are very different, and allow for very little re-use.
For example on printing the probability type has to undo the scaling
so we print 1.0 instead of $bignum.
next prev parent reply other threads:[~2016-02-16 12:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 23:18 [PATCH nft 0/3] meta: random match for statistic sampling Florian Westphal
2016-02-01 23:18 ` [PATCH nft 1/3] evaluate: move default op lookup into helper Florian Westphal
2016-02-01 23:19 ` [PATCH nft 2/3] meta: add prandom matching Florian Westphal
2016-02-04 14:39 ` Patrick McHardy
2016-02-04 14:46 ` Florian Westphal
2016-02-04 15:27 ` Patrick McHardy
2016-02-04 15:32 ` Florian Westphal
2016-02-04 16:09 ` Florian Westphal
2016-02-04 16:42 ` Florian Westphal
2016-02-04 17:40 ` Patrick McHardy
2016-02-15 12:54 ` Florian Westphal
2016-02-16 11:45 ` Pablo Neira Ayuso
2016-02-16 12:00 ` Florian Westphal [this message]
2016-02-16 16:28 ` Pablo Neira Ayuso
2016-02-04 17:38 ` Patrick McHardy
2016-02-01 23:19 ` [PATCH nft 3/3] tests: add test cases for meta random Florian Westphal
2016-02-03 20:23 ` [PATCH nft 0/3] meta: random match for statistic sampling Pablo Neira Ayuso
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=20160216120024.GB13417@breakpoint.cc \
--to=fw@strlen.de \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).