netfilter: xt_recent: fix false match
authorTim Gardner <tim.gardner@canonical.com>
Tue, 23 Feb 2010 13:59:12 +0000 (14:59 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 15 Mar 2010 16:06:40 +0000 (09:06 -0700)
commit 8ccb92ad41cb311e52ad1b1fe77992c7f47a3b63 upstream.

A rule with a zero hit_count will always match.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/netfilter/xt_recent.c

index 1bb0d6c8438c95c5afbdacad1b360a9e61b68541..43e83a44224d5718604c1f78ec5a2f014b3b2168 100644 (file)
@@ -260,7 +260,7 @@ recent_mt(const struct sk_buff *skb, const struct xt_match_param *par)
                for (i = 0; i < e->nstamps; i++) {
                        if (info->seconds && time_after(time, e->stamps[i]))
                                continue;
-                       if (++hits >= info->hit_count) {
+                       if (info->hit_count && ++hits >= info->hit_count) {
                                ret = !ret;
                                break;
                        }