From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@lists.netfilter.org
Subject: [RESEND][PATCH] Recent match jiffies wrap mismatches
Date: Mon, 28 Nov 2005 21:08:13 -0800 [thread overview]
Message-ID: <20051129050813.GA30630@linuxace.com> (raw)
As 2.6.15-rc3 just came out, and the below fixes 3 bugzilla entries (I missed
#370 in the original report), it would be good to get this into 2.6.15 if
possible.
Phil
----- Forwarded message from Phil Oester <kernel@linuxace.com> -----
Date: Wed, 23 Nov 2005 12:03:11 -0800
From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH] Recent match jiffies wrap mismatches
Around jiffies wrap time (i.e. within first 5 mins after boot), recent match
rules which contain both --seconds and --hitcount arguments experience
false matches.
This is because the last_pkts array is filled with zeros on creation, and
when comparing 'now' to 0 (+ --seconds argument), time_before_eq thinks it
has found a hit.
Below patch adds a break if the packet value is zero. This has the unfortunate
side effect of causing mismatches if a packet was received when jiffies really
was equal to zero. The odds of that happening are slim compared to the
problems caused by not adding the break however. Plus, the author used
this same method just below, so it is "good enough".
This fixes bugs #383 and #395.
Phil
Signed-off-by: Phil Oester <kernel@linuxace.com>
diff -ru linux-orig/net/ipv4/netfilter/ipt_recent.c linux-new/net/ipv4/netfilter/ipt_recent.c
--- linux-orig/net/ipv4/netfilter/ipt_recent.c 2005-10-27 20:02:08.000000000 -0400
+++ linux-new/net/ipv4/netfilter/ipt_recent.c 2005-11-23 13:29:29.000000000 -0500
@@ -532,6 +532,7 @@
}
if(info->seconds && info->hit_count) {
for(pkt_count = 0, hits_found = 0; pkt_count < ip_pkt_list_tot; pkt_count++) {
+ if(r_list[location].last_pkts[pkt_count] == 0) break;
if(time_before_eq(now,r_list[location].last_pkts[pkt_count]+info->seconds*HZ)) hits_found++;
}
if(hits_found >= info->hit_count) ans = !info->invert; else ans = info->invert;
----- End forwarded message -----
next reply other threads:[~2005-11-29 5:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-29 5:08 Phil Oester [this message]
2005-11-29 23:03 ` [RESEND][PATCH] Recent match jiffies wrap mismatches Patrick McHardy
2005-11-29 23:51 ` Phil Oester
2005-11-30 7:43 ` Patrick McHardy
2005-11-30 16:20 ` Phil Oester
2005-11-30 19:13 ` Stephen Frost
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=20051129050813.GA30630@linuxace.com \
--to=kernel@linuxace.com \
--cc=netfilter-devel@lists.netfilter.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 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.