]> git.baikalelectronics.ru Git - kernel.git/commit
[NETFILTER]: Fix recent match jiffies wrap mismatches
authorPhil Oester <kernel@linuxace.com>
Thu, 1 Dec 2005 22:29:24 +0000 (14:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Dec 2005 22:29:24 +0000 (14:29 -0800)
commit7488c0bc453832886a0f4c1d97207059f3a6482c
tree4018c6b43c81875c424502ca1b7bc464a22064c0
parentc3db3c8eff3ec567bad3fe1ca4eb78d38f2a433b
[NETFILTER]: Fix 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 netfilter bugs #383 and #395.

Signed-off-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ipt_recent.c