Fix COMMENT in action files

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6208 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-05-03 14:24:56 +00:00
parent 14a243fa20
commit 61fb84d23b

View File

@ -296,7 +296,7 @@ sub process_actions1() {
fatal_error "An action may not invoke itself" if $target eq $action; fatal_error "An action may not invoke itself" if $target eq $action;
add_requiredby $wholetarget, $action if $targettype & ACTION; add_requiredby $wholetarget, $action if $targettype & ACTION;
} else { } elsif ( $target ne 'COMMENT' ) {
$target =~ s!/.*$!!; $target =~ s!/.*$!!;
if ( find_macro $target ) { if ( find_macro $target ) {
@ -396,6 +396,17 @@ sub process_action3( $$$$$ ) {
my ($target, $source, $dest, $proto, $ports, $sports, $rate, $user ) = split_line 1, 8, 'action file'; my ($target, $source, $dest, $proto, $ports, $sports, $rate, $user ) = split_line 1, 8, 'action file';
if ( $target eq 'COMMENT' ) {
if ( $capabilities{COMMENTS} ) {
( $comment = $line ) =~ s/^\s*COMMENT\s*//;
$comment =~ s/\s*$//;
} else {
warning_message "COMMENT ignored -- requires comment support in iptables/Netfilter";
}
next;
}
my $target2 = merge_levels $wholeaction, $target; my $target2 = merge_levels $wholeaction, $target;
my ( $action2 , $level2 ) = split_action $target2; my ( $action2 , $level2 ) = split_action $target2;
@ -403,14 +414,7 @@ sub process_action3( $$$$$ ) {
my $action2type = $targets{isolate_basic_target $action2}; my $action2type = $targets{isolate_basic_target $action2};
unless ( $action2type == STANDARD ) { unless ( $action2type == STANDARD ) {
if ( $target eq 'COMMENT' ) { if ( $action2type & ACTION ) {
if ( $capabilities{COMMENTS} ) {
( $comment = $line ) =~ s/^\s*COMMENT\s*//;
$comment =~ s/\s*$//;
} else {
warning_message "COMMENT ignored -- requires comment support in iptables/Netfilter";
}
} elsif ( $action2type & ACTION ) {
$target2 = (find_logactionchain ( $target = $target2 ))->{name}; $target2 = (find_logactionchain ( $target = $target2 ))->{name};
} else { } else {
die "Internal Error" unless $action2type == MACRO || $action2type & LOGRULE; die "Internal Error" unless $action2type == MACRO || $action2type & LOGRULE;