A couple of minor tweaks to the Chains module.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2014-03-19 10:24:30 -07:00
parent 658f5c6674
commit 54a5e4af52

View File

@ -825,12 +825,13 @@ sub get_opttype( $$ ) { # $option, $default
$opttype{$_[0]} || $_[1]; $opttype{$_[0]} || $_[1];
} }
# # Next a helper for setting an individual option #
# Next a helper for setting an individual option
# #
sub set_rule_option( $$$ ) { sub set_rule_option( $$$ ) {
my ( $ruleref, $option, $value ) = @_; my ( $ruleref, $option, $value ) = @_;
assert( defined $value && reftype $ruleref , $value, $ruleref ); assert( defined $value && reftype $ruleref , $option, $ruleref );
$ruleref->{simple} = 0; $ruleref->{simple} = 0;
$ruleref->{complex} = 1 if reftype $value; $ruleref->{complex} = 1 if reftype $value;
@ -2332,7 +2333,7 @@ sub add_jump( $$$;$$$ ) {
# #
# If the destination is a chain, mark it referenced # If the destination is a chain, mark it referenced
# #
$toref->{referenced} = 1, add_reference $fromref, $toref if $toref; $toref->{referenced} = 1, add_reference( $fromref, $toref ) if $toref;
my $param = $goto_ok && $toref && have_capability( 'GOTO_TARGET' ) ? 'g' : 'j'; my $param = $goto_ok && $toref && have_capability( 'GOTO_TARGET' ) ? 'g' : 'j';
@ -3182,6 +3183,7 @@ sub check_optimization( $ ) {
# Perform Optimization # Perform Optimization
# #
# When an unreferenced chain is found, it is deleted unless its 'dont_delete' flag is set. # When an unreferenced chain is found, it is deleted unless its 'dont_delete' flag is set.
#
sub optimize_level0() { sub optimize_level0() {
for my $table ( qw/raw rawpost mangle nat filter/ ) { for my $table ( qw/raw rawpost mangle nat filter/ ) {
my $tableref = $chain_table{$table}; my $tableref = $chain_table{$table};