All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: NICOLAS BOULIANE <nicboul@gmail.com>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH] libipt_statistic
Date: Mon, 02 Jul 2007 20:16:54 +0200	[thread overview]
Message-ID: <46894116.9000203@trash.net> (raw)
In-Reply-To: <dd45289d0707021105q6b70c23m45135e0a56ccb5aa@mail.gmail.com>

NICOLAS BOULIANE wrote:
> i'm not trying to bother you, but there's surely something I dont
> understand.


Don't worry :)

> In the kernel we have:
>   if (info->u.nth.count++ == info->u.nth.every)
>    info->u.nth.count = 0;
> 
> --every 4 --packet 2
> count = 1, every = 3, packet = 2
> 
> 1th packet:
>           if (1 == 3) { // no match
> 
> 2th packet:
>           if (2 == 3) { // no match
> 
> 3th packet:
>            if (3 == 3) { // match and set __count = 0__
> 
> next time we will match the 4th packet.
> Is what I should expect ? or there's something wrong.


It is. "--every 4" is the period, we'll match every 4th packet.
"--packet 2" says you want to match the third (thats the
non-obvious part) packet.

The main reason why you would --packet at all is for multiple
subsequent rules that don't abort rule traversal:

... --every 4 --packet 0 -j MARK --set-mark 1	(match 1st packet)
... --every 4 --packet 1 -j MARK --set-mark 2	(match 2nd packet)
... --every 4 --packet 2 -j MARK --set-mark 3	(match 3rd packet)
... --every 4 --packet 3 -j MARK --set-mark 4	(match 4th packet)

So for every packet only a single rule will match. You could do
something like that for load-balancing for example.

  reply	other threads:[~2007-07-02 18:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-02  0:10 [PATCH] libipt_statistic NICOLAS BOULIANE
2007-07-02 13:11 ` Patrick McHardy
     [not found]   ` <dd45289d0707020751j6bb5de27k25bc73e4337c818b@mail.gmail.com>
2007-07-02 14:58     ` Patrick McHardy
2007-07-02 15:02       ` Patrick McHardy
2007-07-02 17:38       ` NICOLAS BOULIANE
2007-07-02 17:40         ` Patrick McHardy
2007-07-02 18:05           ` NICOLAS BOULIANE
2007-07-02 18:16             ` Patrick McHardy [this message]
2007-07-02 19:10               ` NICOLAS BOULIANE
2007-07-02 19:14                 ` Patrick McHardy
2007-07-02 19:38                   ` NICOLAS BOULIANE
2007-07-02 19:55                     ` Jan Engelhardt
2007-07-02 20:09                       ` NICOLAS BOULIANE
2007-07-03 11:46                         ` Patrick McHardy
2007-07-03 11:45                     ` Patrick McHardy

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=46894116.9000203@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=nicboul@gmail.com \
    /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.