All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Jan Engelhardt <jengelh@inai.de>
Cc: Florian Westphal <fw@strlen.de>, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 3/4] meta: add probability matching
Date: Thu, 3 Mar 2016 21:32:26 +0100	[thread overview]
Message-ID: <20160303203226.GA2728@breakpoint.cc> (raw)
In-Reply-To: <alpine.LSU.2.20.1603032005570.446@nerf40.vanv.qr>

Jan Engelhardt <jengelh@inai.de> wrote:
> On Thursday 2016-03-03 18:56, Florian Westphal wrote:
> 
> >The float value has to be in range of 0.0000001 to 0.9999999 and
> >+
> >+		if (tmp >= UINT_MAX || d > 0.9999999)
> >+			return error(loc, "Probability " META_PROB_FMT " too %s", d, "big");
> 
> You are misappropriating some 430 points here. 0.9999999 maps to
> just 0xfffffe51.

Sorry, I am not following.
What would you likew to change here?

> >+		*value = (uint32_t) tmp;
> >+		if (*value == 0)
> >+			return error(loc, "Probability " META_PROB_FMT " too %s", d, "small");
> 
> Though d==0 and d==1 are not overly useful, why prohibit them? iptables 
> allowed taking them, and I hear people are working on a translator...*boom*

No, thats easy to translate to nft :-)

1.0 -> ""
0.0 -> "#"

i.e. not print a "1.0" match, its always true so irrelevant and print
comment a sign (#) to make nft ignore whatever comes after it, since it
did not match in the iptables rule either.

  reply	other threads:[~2016-03-03 20:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 17:56 [PATCH nft 1/3] expression: add helper to decide if operator needs to be shown Florian Westphal
2016-03-03 17:56 ` [PATCH nft 3/4] meta: add probability matching Florian Westphal
2016-03-03 19:36   ` Jan Engelhardt
2016-03-03 20:32     ` Florian Westphal [this message]
2016-03-03 20:45       ` Jan Engelhardt
2016-03-04 11:12         ` Florian Westphal
2016-03-04 12:34           ` Jan Engelhardt
2016-03-04 13:13             ` Florian Westphal
2016-03-03 17:56 ` [PATCH nft 4/4] meta: add tests for " Florian Westphal

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=20160303203226.GA2728@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=jengelh@inai.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 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.