mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 14:48:51 +01:00
Streamline PERL in action.Drop and action.Reject
- Rename read_action_param => get_action_params - Allow it to accept a list of indexes and to return a list Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
bbf853bd1d
commit
b43bee2c62
@ -52,7 +52,7 @@ our @EXPORT = qw(
|
||||
progress_message2
|
||||
progress_message3
|
||||
supplied
|
||||
read_action_param
|
||||
get_action_params
|
||||
set_action_param
|
||||
);
|
||||
|
||||
@ -1840,11 +1840,15 @@ sub default_action_params {
|
||||
}
|
||||
}
|
||||
|
||||
sub read_action_param( $ ) {
|
||||
my $i = shift;
|
||||
sub get_action_params {
|
||||
my @values;
|
||||
|
||||
fatal_error "Parameter numbers must be numeric" unless $i =~ /^\d+$/;
|
||||
$actparms{$i};
|
||||
for ( @_ ) {
|
||||
fatal_error "Parameter numbers must be numeric" unless $_ =~ /^\d+$/;
|
||||
push @values, $actparms{$_};
|
||||
}
|
||||
|
||||
@values;
|
||||
}
|
||||
|
||||
sub set_action_param( $$ ) {
|
||||
|
@ -35,11 +35,9 @@ FORMAT 2
|
||||
BEGIN PERL
|
||||
use Shorewall::Config;
|
||||
|
||||
my $p1 = read_action_param(1);
|
||||
my ($p1, $p2, $p3 ) = get_action_params(1, 2, 3);
|
||||
|
||||
if ( defined $p1 && $p1 eq 'audit' ) {
|
||||
my ( $p2, $p3 ) = ( read_action_param(2) , read_action_param(3) );
|
||||
|
||||
set_action_param( 2, 'A_REJECT') unless defined $p2;
|
||||
set_action_param( 3, 'A_DROP') unless defined $p3;
|
||||
};
|
||||
|
@ -31,11 +31,9 @@ FORMAT 2
|
||||
BEGIN PERL
|
||||
use Shorewall::Config;
|
||||
|
||||
my $p1 = read_action_param(1);
|
||||
my ( $p1, $p2, $p3 ) = get_action_params(1, 2, 3);
|
||||
|
||||
if ( defined $p1 && $p1 eq 'audit' ) {
|
||||
my ( $p2, $p3 ) = ( read_action_param(2) , read_action_param(3) );
|
||||
|
||||
set_action_param( 2, 'A_REJECT') unless defined $p2;
|
||||
set_action_param( 3, 'A_REJECT') unless defined $p3;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user