Allow logging rules with more than 15 ports

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-07-08 15:59:54 -07:00
parent 43d4a8dcf8
commit 411ca87ec3

View File

@ -2345,11 +2345,13 @@ sub add_expanded_jump( $$$$ ) {
add_reference( $chainref, $toref ) while --$splitcount > 0; add_reference( $chainref, $toref ) while --$splitcount > 0;
} }
sub add_ijump( $$$;@ ) { sub add_ijump_internal( $$$$;@ ) {
my ( $fromref, $jump, $to, @matches ) = @_; my ( $fromref, $jump, $to, $expandports, @matches ) = @_;
return $dummyrule if $fromref->{complete}; return $dummyrule if $fromref->{complete};
our $splitcount;
my $toref; my $toref;
my $ruleref; my $ruleref;
# #
@ -2383,50 +2385,12 @@ sub add_ijump( $$$;@ ) {
$fromref->{complete} = 1 if $jump eq 'g' || $terminating{$to}; $fromref->{complete} = 1 if $jump eq 'g' || $terminating{$to};
} }
push_irule( $fromref, $ruleref ); $expandports ? handle_port_ilist( $fromref, $ruleref, 1 ) : push_irule( $fromref, $ruleref );
} }
sub add_expanded_ijump( $$$;@ ) { sub add_ijump( $$$;@ ) {
my ( $fromref, $jump, $to, @matches ) = @_; my ( $fromref, $jump, $to, @matches ) = @_;
add_ijump_internal( $fromref, $jump, $to, 0, @matches );
return $dummyrule if $fromref->{complete};
our $splitcount = 0;
my $toref;
my $ruleref;
#
# The second argument may be a scalar (chain name or builtin target) or a chain reference
#
if ( reftype $to ) {
$toref = $to;
$to = $toref->{name};
} else {
#
# Ensure that we have the chain unless it is a builtin like 'ACCEPT'
#
my ( $target ) = split ' ', $to;
$toref = $chain_table{$fromref->{table}}{$target};
fatal_error "Unknown rule target ($to)" unless $toref || $builtin_target{$target};
}
#
# If the destination is a chain, mark it referenced
#
if ( $toref ) {
$toref->{referenced} = 1;
add_reference $fromref, $toref;
$jump = 'j' unless have_capability 'GOTO_TARGET';
$ruleref = create_irule ($fromref, $jump => $to, @matches );
} else {
$ruleref = create_irule( $fromref, 'j' => $to, @matches );
}
if ( $ruleref->{simple} ) {
$fromref->{complete} = 1 if $jump eq 'g' || $terminating{$to};
}
handle_port_ilist( $fromref, $ruleref, 1 );
} }
sub insert_ijump( $$$$;@ ) { sub insert_ijump( $$$$;@ ) {
@ -6264,7 +6228,7 @@ sub log_irule_limit( $$$$$$$@ ) {
} }
if ( $command eq 'add' ) { if ( $command eq 'add' ) {
add_ijump ( $chainref, j => $prefix , @matches ); add_ijump_internal ( $chainref, j => $prefix , 1, @matches );
} else { } else {
insert_ijump ( $chainref, j => $prefix, 0 , @matches ); insert_ijump ( $chainref, j => $prefix, 0 , @matches );
} }