mirror of
https://gitlab.com/shorewall/code.git
synced 2025-05-30 14:38:53 +02:00
Make 'map_old_actions' a little cleaner
This commit is contained in:
parent
7c1dd35a00
commit
212937a29d
@ -268,25 +268,29 @@ sub add_requiredby ( $$ ) {
|
|||||||
#
|
#
|
||||||
# Map pre-3.0 actions to the corresponding Macro invocation
|
# Map pre-3.0 actions to the corresponding Macro invocation
|
||||||
#
|
#
|
||||||
|
|
||||||
|
sub find_old_action ( $$$ ) {
|
||||||
|
my ( $target, $macro, $param ) = @_;
|
||||||
|
|
||||||
|
if ( my $actiontype = find_macro( $macro ) ) {
|
||||||
|
( $macro, $actiontype , $param );
|
||||||
|
} else {
|
||||||
|
( $target, 0, '' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub map_old_actions( $ ) {
|
sub map_old_actions( $ ) {
|
||||||
my $target = shift;
|
my $target = shift;
|
||||||
my $macro;
|
|
||||||
my $param;
|
|
||||||
|
|
||||||
if ( $target =~ /^Allow(.*)$/ ) {
|
if ( $target =~ /^Allow(.*)$/ ) {
|
||||||
$macro = $1;
|
find_old_action( $target, $1, 'ACCEPT' );
|
||||||
$param = 'ACCEPT';
|
} elsif ( $target =~ /^Drop(.*)$/ ) {
|
||||||
} elsif ( $target =~ /^Drop(.*)$/ ) {
|
find_old_action( $target, $1, 'DROP' );
|
||||||
$macro = $1;
|
|
||||||
$param = 'DROP';
|
|
||||||
} elsif ( $target = /^Reject(.*)$/ ) {
|
} elsif ( $target = /^Reject(.*)$/ ) {
|
||||||
$macro = $1;
|
find_old_action( $target, $1, 'REJECT' );
|
||||||
$param = 'REJECT';
|
|
||||||
} else {
|
} else {
|
||||||
return ( $target, 0, '' );
|
( $target, 0, '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
( $macro, find_macro( $macro ) , $param );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user