]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: xt_recent: don't reject rule if new hitcount exceeds table max
authorFlorian Westphal <fw@strlen.de>
Fri, 13 Feb 2015 11:47:50 +0000 (12:47 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 16 Feb 2015 16:00:47 +0000 (17:00 +0100)
commit068627c1580807c5ddd476355041f449884d07dd
tree8f41fb1c365d88e1a1cd3e772e21534868bd82c9
parentb8e0269835870eb79bb6c1dea60bfc23a629abda
netfilter: xt_recent: don't reject rule if new hitcount exceeds table max

given:
-A INPUT -m recent --update --seconds 30 --hitcount 4
and
iptables-save > foo

then
iptables-restore < foo

will fail with:
kernel: xt_recent: hitcount (4) is larger than packets to be remembered (4) for table DEFAULT

Even when the check is fixed, the restore won't work if the hitcount is
increased to e.g. 6, since by the time checkentry runs it will find the
'old' incarnation of the table.

We can avoid this by increasing the maximum threshold silently; we only
have to rm all the current entries of the table (these entries would
not have enough room to handle the increased hitcount).

This even makes (not-very-useful)
-A INPUT -m recent --update --seconds 30 --hitcount 4
-A INPUT -m recent --update --seconds 30 --hitcount 42
work.

Fixes: 422f565f76644cb1265c (netfilter: xt_recent: relax ip_pkt_list_tot restrictions)
Tracked-down-by: Chris Vine <chris@cvine.freeserve.co.uk>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/xt_recent.c