All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libipt_statistic
@ 2007-07-02  0:10 NICOLAS BOULIANE
  2007-07-02 13:11 ` Patrick McHardy
  0 siblings, 1 reply; 15+ messages in thread
From: NICOLAS BOULIANE @ 2007-07-02  0:10 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

Hi Patrick,

I think that this calculation is erroneous:
info->u.nth.count = info->u.nth.every - info->u.nth.packet;

ex: --mode nth --every 4 --packet 6
AIUI, we want to drop the 4th packet after 6 packets have pass.
Base on this example, we want to match the 10th packet.

But we are gonna match the 7th packet, wich is wrong.
   count: -3
   every: 3
   packet: 6

 -3,  -2, -1,  0,  1,  2,  (3) -- Increment
  1,   2,   3,  4,  5,  6,   7  -- nth packet

comments are welcome.
--
I think that my patch introduce space at the beginning of each line,
someone could give me a vim hint to avoid that ? thanks.
--

acidfu

[-- Attachment #2: libipt_statistic.c.patch --]
[-- Type: text/x-patch, Size: 726 bytes --]

Index: libipt_statistic.c
===================================================================
--- libipt_statistic.c	(revision 6894)
+++ libipt_statistic.c	(working copy)
@@ -113,7 +113,7 @@
 	if (flags & 0x8 && info->mode != XT_STATISTIC_MODE_NTH)
 		exit_error(PARAMETER_PROBLEM,
 			   "--packet can only be used in nth mode");
-	info->u.nth.count = info->u.nth.every - info->u.nth.packet;
+	info->u.nth.count = -info->u.nth.packet;
 }
 
 /* Prints out the matchinfo. */
@@ -156,7 +156,7 @@
 	print_match(info, "--");
 }
 
-static struct iptables_match statistic = { 
+static struct iptables_match statistic = {
 	.name		= "statistic",
 	.version	= IPTABLES_VERSION,
 	.size		= IPT_ALIGN(sizeof(struct xt_statistic_info)),

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-07-03 11:46 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.