Make generation of 'stop' ruleset activation more foolproof.

Signed-off-by: Tom Eastep <teastep@shorewall.net>

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9764 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-03-30 19:58:26 +00:00
parent b215f91d4a
commit 22526979db

View File

@ -2745,6 +2745,17 @@ sub emitr( $$ ) {
} }
} }
#
# Simple version that only handles rules
#
sub emitr1( $$ ) {
my ( $name, $rule ) = @_;
assert( substr( $rule, 0, 2 ) eq '-A' );
emit_unindented join( ' ', '-A', $name, substr( $rule, 3 ) );
}
# #
# Generate the netfilter input # Generate the netfilter input
# #
@ -2999,9 +3010,7 @@ sub create_stop_load( $ ) {
'', '',
'progress_message2 "Running $command..."', 'progress_message2 "Running $command..."',
'', '',
'$command <<EOF' ); '$command <<__EOF__' );
$mode = CAT_MODE;
unless ( $test ) { unless ( $test ) {
my $date = localtime; my $date = localtime;
@ -3040,16 +3049,15 @@ sub create_stop_load( $ ) {
# Then emit the rules # Then emit the rules
# #
for my $chainref ( @chains ) { for my $chainref ( @chains ) {
emitr $chainref->{name}, $_ for @{$chainref->{rules}}; emitr1 $chainref->{name}, $_ for @{$chainref->{rules}};
} }
# #
# Commit the changes to the table # Commit the changes to the table
# #
assert( $mode == CAT_MODE );
emit_unindented 'COMMIT'; emit_unindented 'COMMIT';
} }
emit_unindented 'EOF'; emit_unindented '__EOF__';
# #
# Test result # Test result
# #