From a40c74ddec2320f5d826a5079e5b423b1576ce6e Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Thu, 24 Jan 2013 09:04:50 -0800 Subject: [PATCH] Eliminate forward declaration of finish_chain_section() Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Rules.pm | 58 +++++++++++++++---------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index 480c8d807..9d1c3367e 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -836,36 +836,6 @@ sub optimize_policy_chains() { # Modules moved from the Chains module in 4.4.18 ################################################################################ -sub finish_chain_section( $$$ ); - -# -# Create a rules chain if necessary and populate it with the appropriate ESTABLISHED,RELATED rule(s) and perform SYN rate limiting. -# -# Return a reference to the chain's table entry. -# -sub ensure_rules_chain( $ ) -{ - my ($chain) = @_; - - my $chainref = $filter_table->{$chain}; - - $chainref = new_rules_chain( $chain ) unless $chainref; - - unless ( $chainref->{referenced} ) { - if ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ) { - finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID'; - } elsif ( $section == INVALID_SECTION ) { - finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED'; - } elsif ( $section == RELATED_SECTION ) { - finish_chain_section $chainref , $chainref, 'ESTABLISHED'; - } - - $chainref->{referenced} = 1; - } - - $chainref; -} - # # Add ESTABLISHED,RELATED,INVALID rules and synparam jumps to the passed chain # @@ -991,6 +961,34 @@ sub finish_chain_section ($$$) { pop_comment( $save_comment ); } +# +# Create a rules chain if necessary and populate it with the appropriate ESTABLISHED,RELATED rule(s) and perform SYN rate limiting. +# +# Return a reference to the chain's table entry. +# +sub ensure_rules_chain( $ ) +{ + my ($chain) = @_; + + my $chainref = $filter_table->{$chain}; + + $chainref = new_rules_chain( $chain ) unless $chainref; + + unless ( $chainref->{referenced} ) { + if ( $section & ( NEW_SECTION | DEFAULTACTION_SECTION ) ) { + finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED,INVALID'; + } elsif ( $section == INVALID_SECTION ) { + finish_chain_section $chainref , $chainref, 'ESTABLISHED,RELATED'; + } elsif ( $section == RELATED_SECTION ) { + finish_chain_section $chainref , $chainref, 'ESTABLISHED'; + } + + $chainref->{referenced} = 1; + } + + $chainref; +} + # # Do section-end processing #