Correct handling of family switch in tcfilters processing

This commit is contained in:
Tom Eastep 2010-11-18 06:56:07 -08:00
parent e052951890
commit 63e5f6aff9
2 changed files with 9 additions and 6 deletions

View File

@ -1792,7 +1792,7 @@ sub embedded_perl( $ ) {
# - Remove trailing comments. # - Remove trailing comments.
# - Handle Line Continuation # - Handle Line Continuation
# - Handle embedded SHELL and PERL scripts # - Handle embedded SHELL and PERL scripts
# - Expand shell variables from $ENV. # - Expand shell variables from %params and %ENV.
# - Handle INCLUDE <filename> # - Handle INCLUDE <filename>
# #
@ -1864,6 +1864,9 @@ sub read_a_line(;$) {
while ( $currentline =~ m( ^(.*?) \$({)? ([a-zA-Z]\w*) (?(2)}) (.*)$ )x ) { while ( $currentline =~ m( ^(.*?) \$({)? ([a-zA-Z]\w*) (?(2)}) (.*)$ )x ) {
unless ( exists $params{$3} ) { unless ( exists $params{$3} ) {
#
# Given the way that getparams works, this should never help but better safe than sorry
#
$params{$3} = $ENV{$3} if exists $ENV{$3}; $params{$3} = $ENV{$3} if exists $ENV{$3};
} }

View File

@ -1187,9 +1187,9 @@ sub process_tcfilters() {
while ( read_a_line ) { while ( read_a_line ) {
if ( $currentline =~ /^\s*IPV4\s*$/ ) { if ( $currentline =~ /^\s*IPV4\s*$/ ) {
$family = F_IPV4; Shorewall::IPAddrs::initialize( $family = F_IPV4 ) unless $family == F_IPV4;
} elsif ( $currentline =~ /^\s*IPV6\s*$/ ) { } elsif ( $currentline =~ /^\s*IPV6\s*$/ ) {
$family = F_IPV6; Shorewall::IPAddrs::initialize( $family = F_IPV6 ) unless $family == F_IPV6;
} elsif ( $currentline =~ /^\s*ALL\s*$/ ) { } elsif ( $currentline =~ /^\s*ALL\s*$/ ) {
$family = 0; $family = 0;
} elsif ( $family ) { } elsif ( $family ) {
@ -1198,15 +1198,15 @@ sub process_tcfilters() {
push @family, $family; push @family, $family;
for ( F_IPV4, F_IPV6 ) { for ( F_IPV4, F_IPV6 ) {
$family = $_; Shorewall::IPAddrs::initialize( $family = $_ );
process_tc_filter; process_tc_filter;
} }
$family = pop @family; Shorewall::IPAddrs::initialize( $family = pop @family );
} }
} }
$family = pop @family; Shorewall::IPAddrs::initialize( $family = pop @family );
} }
} }