netfilter: {ip, ip6, arp}_tables: fix incorrect loop detection
authorPatrick McHardy <kaber@trash.net>
Mon, 6 Apr 2009 15:31:29 +0000 (17:31 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 2 May 2009 17:56:47 +0000 (10:56 -0700)
commit045918d8181b1a06632173d225120e832fbac3bc
tree7f863c4baf9345496323f702ec2f3eadd70779f7
parentcf9796ba9125e991f27b20dd984a23d52857bcbd
netfilter: {ip, ip6, arp}_tables: fix incorrect loop detection

upstream commit: 1f9352ae2253a97b07b34dcf16ffa3b4ca12c558

Commit e1b4b9f ([NETFILTER]: {ip,ip6,arp}_tables: fix exponential worst-case
search for loops) introduced a regression in the loop detection algorithm,
causing sporadic incorrectly detected loops.

When a chain has already been visited during the check, it is treated as
having a standard target containing a RETURN verdict directly at the
beginning in order to not check it again. The real target of the first
rule is then incorrectly treated as STANDARD target and checked not to
contain invalid verdicts.

Fix by making sure the rule does actually contain a standard target.

Based on patch by Francis Dupont <Francis_Dupont@isc.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c