netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Subject: [PATCH nft 0/3] meta: random match for statistic sampling
Date: Tue,  2 Feb 2016 00:18:58 +0100	[thread overview]
Message-ID: <1454368741-16368-1-git-send-email-fw@strlen.de> (raw)

Replacement for iptables -m statistic 'random' mode.
I added it to meta match even though its not directly related to an skb
member. We already have cpu match which isn't related to skb either and
adding a new expression just for this seemed overkill.

If you'd rather like a new prandom expression just let me know and
I can rework it.

There is also a libnftnl patch but its only so that debug output
displays 'meta prandom' rather than 'meta unknown'.

Result after several minutes of constant flooding:

counter packets 2961796882 bytes 248790938088
meta random <= 0.900000000 counter packets 2665649546 bytes 223914561864
meta random <= 0.500000000 counter packets 1480856860 bytes 124391976240
meta random <= 0.100000000 counter packets 296190072 bytes 24879966048
meta random <= 0.010000000 counter packets 29618610 bytes 2487963240
meta random <= 0.001000000 counter packets 2963660 bytes 248947440
meta random <= 0.000100000 counter packets 295486 bytes 24820824
meta random <= 0.000010000 counter packets 29450 bytes 2473800
meta random <= 0.000001000 counter packets 2911 bytes 244524
meta random <= 0.000000100 counter packets 267 bytes 22428
meta random <= 0.000000010 counter packets 26 bytes 2184
meta random <= 0.000000001 counter packets 4 bytes 336

... so it seems to work as intended.

Let me know if you spot any issues with current approach.

Kernel part only does '*dest = prandom_u32()', I'll submit it once
I know that this approach is deemed sane.

Thanks!

             reply	other threads:[~2016-02-01 23:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 23:18 Florian Westphal [this message]
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
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=1454368741-16368-1-git-send-email-fw@strlen.de \
    --to=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).