From b1c5eefb6b312e247be2e86b953d73b32faa32e4 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 11 Apr 2008 02:46:17 +0000 Subject: [PATCH] Add accounting-rule sanity check git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8422 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Accounting.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Shorewall-perl/Shorewall/Accounting.pm b/Shorewall-perl/Shorewall/Accounting.pm index 04f18d5d6..6d4eff02f 100644 --- a/Shorewall-perl/Shorewall/Accounting.pm +++ b/Shorewall-perl/Shorewall/Accounting.pm @@ -144,8 +144,6 @@ sub process_accounting_rule( $$$$$$$$$ ) { my $chainref = ensure_accounting_chain $chain; - check_chain( $chainref ); - expand_rule $chainref , $restriction , @@ -179,6 +177,8 @@ sub setup_accounting() { first_entry "$doing $fn..."; + my $nonEmpty = 0; + while ( read_a_line ) { my ( $action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark ) = split_line1 1, 9, 'Accounting File'; @@ -186,10 +186,13 @@ sub setup_accounting() { if ( $action eq 'COMMENT' ) { process_comment; } else { + $nonEmpty = 1; process_accounting_rule $action, $chain, $source, $dest, $proto, $ports, $sports, $user, $mark; } } + fatal_error "Accounring rules are isolated" if $nonEmpty && ! $filter_table->{accounting}; + clear_comment; if ( have_bridges ) {