From a1eefea22417de9c6e7e1f34084212e8469b3929 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 13 Feb 2011 08:23:48 -0800 Subject: [PATCH] Fix FORWARD chain jumps with sectioning --- Shorewall/Perl/Shorewall/Accounting.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Accounting.pm b/Shorewall/Perl/Shorewall/Accounting.pm index be7ec07a8..a7c8a2bfb 100644 --- a/Shorewall/Perl/Shorewall/Accounting.pm +++ b/Shorewall/Perl/Shorewall/Accounting.pm @@ -355,8 +355,12 @@ sub setup_accounting() { if ( $filter_table->{accounting} ) { optimize_okay( 'accounting' ) if $section; - for my $chain ( qw/INPUT FORWARD/ ) { - add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 ); + if ( $asection ) { + add_jump( $filter_table->{FORWARD}, 'accounting', 0, '', 0, 0 ); + } else { + for my $chain ( qw/INPUT FORWARD/ ) { + add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 ); + } } } @@ -364,8 +368,12 @@ sub setup_accounting() { add_jump( $filter_table->{OUTPUT}, 'accountout', 0, '', 0, 0 ); } } elsif ( $filter_table->{accounting} ) { - for my $chain ( qw/INPUT FORWARD OUTPUT/ ) { - add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 ); + if ( $asection ) { + add_jump( $filter_table->{FORWARD}, 'accounting', 0, '', 0, 0 ); + } else { + for my $chain ( qw/INPUT FORWARD OUTPUT/ ) { + add_jump( $filter_table->{$chain}, 'accounting', 0, '', 0, 0 ); + } } }