From 1fa2db41a1822408abb2f88c32bfc31d08f1aeed Mon Sep 17 00:00:00 2001 From: teastep Date: Mon, 23 Jul 2007 19:46:54 +0000 Subject: [PATCH] Finish rule emission change git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6945 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Chains.pm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Shorewall-perl/Shorewall/Chains.pm b/Shorewall-perl/Shorewall/Chains.pm index 6c2df484f..076316c76 100644 --- a/Shorewall-perl/Shorewall/Chains.pm +++ b/Shorewall-perl/Shorewall/Chains.pm @@ -1830,13 +1830,6 @@ sub assure_cat_state() { } } -sub assure_cmd_state() { - unless ( $state == CMD_STATE ) { - emit_unindented "__EOF__\n" if $state == CAT_STATE; - $state = CMD_STATE; - } -} - # # Emits the passed rule (input to iptables-restore) or command # @@ -1847,10 +1840,19 @@ sub emitr( $ ) { # # A command rather than a rule # - assure_cmd_state; + unless ( $state == CMD_STATE ) { + emit_unindented "__EOF__\n" if $state == CAT_STATE; + $state = CMD_STATE; + } + emit $rule; } else { - assure_cat_state; + unless ( $state == CAT_STATE ) { + emit ''; + emit 'cat >&3 << __EOF__'; + $state = CAT_STATE; + } + emit_unindented $rule; } } @@ -1915,8 +1917,9 @@ sub create_netfilter_load() { push @table_list, 'mangle' if $capabilities{MANGLE_ENABLED}; push @table_list, 'filter'; + assure_cat_state; + for my $table ( @table_list ) { - assure_cat_state; emit_unindented "*$table"; my @chains;