From 444a38ae2ec0a1ac20c0ccb38a3457f2234fd3d7 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 12 Dec 2010 12:22:12 -0800 Subject: [PATCH] Add a chain reference argument to process_rule_common() Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Actions.pm | 11 ++++++----- Shorewall/Perl/Shorewall/Rules.pm | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Actions.pm b/Shorewall/Perl/Shorewall/Actions.pm index 7090f9aa4..0debe6ac8 100644 --- a/Shorewall/Perl/Shorewall/Actions.pm +++ b/Shorewall/Perl/Shorewall/Actions.pm @@ -624,6 +624,8 @@ sub process_actions2 () { } } +sub process_rule_common ( $$$$$$$$$$$$$$$$ ); + # # This function is called to process each rule generated from an action file. # @@ -1005,8 +1007,6 @@ sub process_actions3 () { } } -sub process_rule_common ( $$$$$$$$$$$$$$$ ); - # # Expand a macro rule from the rules file # @@ -1091,6 +1091,7 @@ sub process_macro ( $$$$$$$$$$$$$$$$ ) { } $generated |= process_rule_common( + undef, # $chainref $mtarget, $param, $msource, @@ -1124,8 +1125,8 @@ sub process_macro ( $$$$$$$$$$$$$$$$ ) { # Once a rule has been expanded via wildcards (source and/or dest zone eq 'all'), it is processed by this function. If # the target is a macro, the macro is expanded and this function is called recursively for each rule in the expansion. # -sub process_rule_common ( $$$$$$$$$$$$$$$ ) { - my ( $target, $current_param, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, $headers, $wildcard ) = @_; +sub process_rule_common ( $$$$$$$$$$$$$$$$ ) { + my ( $chainref, $target, $current_param, $source, $dest, $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, $headers, $wildcard ) = @_; my ( $action, $loglevel) = split_action $target; my ( $basictarget, $param ) = get_target_param $action; my $rule = ''; @@ -1288,7 +1289,7 @@ sub process_rule_common ( $$$$$$$$$$$$$$$ ) { $restriction = INPUT_RESTRICT if $destref && ( $destref->{type} == FIREWALL || $destref->{type} == VSERVER ); } - my ( $chain, $chainref, $policy ); + my ( $chain, $policy ); # # For compatibility with older Shorewall versions # diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index 49e041213..f06caed55 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -1008,7 +1008,22 @@ sub process_rule ( ) { my $destzone = (split( /:/, $dest, 2 ) )[0]; $destzone = $action =~ /^REDIRECT/ ? $fw : '' unless defined_zone $destzone; if ( ! $wild || $intrazone || ( $sourcezone ne $destzone ) ) { - $generated |= process_rule_common $target, '', $source, $dest , $proto, $ports, $sports, $origdest, $ratelimit, $user, $mark, $connlimit, $time, $headers, $wild; + $generated |= process_rule_common( undef, + $target, + '', + $source, + $dest, + $proto, + $ports, + $sports, + $origdest, + $ratelimit, + $user, + $mark, + $connlimit, + $time, + $headers, + $wild ); } } }