[PATCH] libipt_statistic

NICOLAS BOULIANE nicboul at gmail.com
Mon Jul 2 20:05:08 CEST 2007


On 7/2/07, Patrick McHardy <kaber at trash.net> wrote:
> NICOLAS BOULIANE wrote:
> > On 7/2/07, Patrick McHardy <kaber at trash.net> wrote:
> >
> >> It starts at zero and goes up to n - 1. So for the second
> >> packet you would actually use --packet 1. A bit
> >> counterintuitive, I agree, but too late to change.
> >
> > with --every 4 --packet 2
> > [ count = every - packet ]
> >
> > in the final check:
> > count = 1
> > every = 3
> > packet = 2
> >
> > I don't see what is starting at zero.
>
> The count. --packet n will match the n+1th packet.
>
>

i'm not trying to bother you, but there's surely something I dont understand.

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.

thanks,
acidfu



More information about the netfilter-devel mailing list