nth match: using more than 1 counter
Hello,
The userspace part of the nth match (BTW, quite an useful one)
seems to be a bit broken. (at least in the CVS version from the
WWW frontend (don't know if there are any other ones ;), i'm
new to netfilter developement): http://cvs.netfilter.org/cgi-bin/cvsweb/~checkout~/netfilter/userspace/extensions/libipt_nth.c)
around line 102, in parse(), there is a fragment doing some checks concerning the --every option:
--- CUT ---
nthinfo->packet = 0xFF;
if(!(*flags & IPT_NTH_OPT_EVERY))
{
nthinfo->counter = 0;
}--- CUT ---
... but actually, the IPT_NTH_OPT_EVERY flag is
set only in this function, but after this part. So, if
you specify --every after --counter, the previous nthinfo->counter will be always lost, which will make the match behave quite improperly in case you use more than a one counter... i guess this check should be something like:
--- CUT ---
libipt_nth.c Sat Dec 7 05:29:28 2002 renamed from libipt_nth.c.old Sat Dec 7 05:47:47 2002 +1 -1
@@ -100,7 +101,7 @@ nthinfo->every = num-1; nthinfo->startat = 0; nthinfo->packet = 0xFF; - if(!(*flags & IPT_NTH_OPT_EVERY)) + if(!(*flags & IPT_NTH_OPT_COUNTER)) { nthinfo->counter = 0; }
--- CUT ---
Matthew Golicz, IP Network Dept., Cable Television "Elsat" Ltd.
Signature · 4 lines
______________________________________________________________________ mteg <[email protected]> * MG452-RIPE * Mateusz Golicz * ,,I just had a thought I have seen everything in this lifetime, but* * now I sit here and watch a cyborg diving ... in her spare time!'' *