forked from extern/shorewall_code
Add a RETURNS flag to optflags indicating that there is RETURN in the chain.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
e54563d9c1
commit
011dd2c901
@ -407,7 +407,7 @@ use constant {
|
|||||||
|
|
||||||
use constant { OPTIMIZE_MASK => OPTIMIZE_POLICY_MASK | OPTIMIZE_RULESET_MASK };
|
use constant { OPTIMIZE_MASK => OPTIMIZE_POLICY_MASK | OPTIMIZE_RULESET_MASK };
|
||||||
|
|
||||||
use constant { DONT_OPTIMIZE => 1 , DONT_DELETE => 2, DONT_MOVE => 4 };
|
use constant { DONT_OPTIMIZE => 1 , DONT_DELETE => 2, DONT_MOVE => 4, RETURNS => 8, RETURNS_DONT_MOVE => 12 };
|
||||||
|
|
||||||
our %dscpmap = ( CS0 => 0x00,
|
our %dscpmap = ( CS0 => 0x00,
|
||||||
CS1 => 0x08,
|
CS1 => 0x08,
|
||||||
@ -1040,7 +1040,7 @@ sub push_rule( $$ ) {
|
|||||||
|
|
||||||
push @{$chainref->{rules}}, $ruleref;
|
push @{$chainref->{rules}}, $ruleref;
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
$chainref->{optflags} |= DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
$chainref->{optflags} |= RETURNS_DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
||||||
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1]" ) if $debug;
|
trace( $chainref, 'A', @{$chainref->{rules}}, "-A $chainref->{name} $_[1]" ) if $debug;
|
||||||
|
|
||||||
$chainref->{complete} = 1 if $complete;
|
$chainref->{complete} = 1 if $complete;
|
||||||
@ -1057,7 +1057,7 @@ sub add_trule( $$ ) {
|
|||||||
assert( reftype $ruleref , $ruleref );
|
assert( reftype $ruleref , $ruleref );
|
||||||
push @{$chainref->{rules}}, $ruleref;
|
push @{$chainref->{rules}}, $ruleref;
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
$chainref->{optflags} |= DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
$chainref->{optflags} |= RETURNS_DONT_MOVE if ( $ruleref->{target} || '' ) eq 'RETURN';
|
||||||
|
|
||||||
trace( $chainref, 'A', @{$chainref->{rules}}, format_rule( $chainref, $ruleref ) ) if $debug;
|
trace( $chainref, 'A', @{$chainref->{rules}}, format_rule( $chainref, $ruleref ) ) if $debug;
|
||||||
|
|
||||||
@ -1237,7 +1237,7 @@ sub push_irule( $$$;@ ) {
|
|||||||
if ( $jump ) {
|
if ( $jump ) {
|
||||||
$ruleref->{jump} = $jump;
|
$ruleref->{jump} = $jump;
|
||||||
$ruleref->{target} = $target;
|
$ruleref->{target} = $target;
|
||||||
$chainref->{optflags} |= DONT_MOVE if $target eq 'RETURN';
|
$chainref->{optflags} |= RETURNS_DONT_MOVE if $target eq 'RETURN';
|
||||||
$ruleref->{targetopts} = $targetopts if $targetopts;
|
$ruleref->{targetopts} = $targetopts if $targetopts;
|
||||||
} else {
|
} else {
|
||||||
$ruleref->{target} = '';
|
$ruleref->{target} = '';
|
||||||
|
@ -724,8 +724,6 @@ sub handle_nonat_rule( $$$$$$$$$$ ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_optflags( $nonat_chain, DONT_MOVE | DONT_OPTIMIZE ) if $tgt eq 'RETURN';
|
|
||||||
|
|
||||||
expand_rule( $nonat_chain ,
|
expand_rule( $nonat_chain ,
|
||||||
PREROUTE_RESTRICT ,
|
PREROUTE_RESTRICT ,
|
||||||
$rule ,
|
$rule ,
|
||||||
|
@ -2475,8 +2475,6 @@ sub process_rule1 ( $$$$$$$$$$$$$$$$$$ ) {
|
|||||||
if ( $actiontype & ACTION ) {
|
if ( $actiontype & ACTION ) {
|
||||||
$action = $usedactions{$normalized_target}{name};
|
$action = $usedactions{$normalized_target}{name};
|
||||||
$loglevel = '';
|
$loglevel = '';
|
||||||
} else {
|
|
||||||
set_optflags( $chainref , DONT_MOVE | DONT_OPTIMIZE ) if $action eq 'RETURN';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $origdest ) {
|
if ( $origdest ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user