mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-20 09:47:51 +02:00
Eliminate globals{STATEMATCH}
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
6803ce5d41
commit
18e7e43b2f
@ -77,6 +77,8 @@ our @EXPORT = ( qw(
|
|||||||
dont_delete
|
dont_delete
|
||||||
dont_move
|
dont_move
|
||||||
add_interface_options
|
add_interface_options
|
||||||
|
state_match
|
||||||
|
state_imatch
|
||||||
|
|
||||||
STANDARD
|
STANDARD
|
||||||
NATRULE
|
NATRULE
|
||||||
|
@ -662,8 +662,7 @@ sub initialize( $;$$) {
|
|||||||
TC_SCRIPT => '',
|
TC_SCRIPT => '',
|
||||||
EXPORT => 0,
|
EXPORT => 0,
|
||||||
KLUDGEFREE => '',
|
KLUDGEFREE => '',
|
||||||
STATEMATCH => '-m state --state',
|
VERSION => "4.5.19-Beta1",
|
||||||
VERSION => "4.5.18-Beta1",
|
|
||||||
CAPVERSION => 40515 ,
|
CAPVERSION => 40515 ,
|
||||||
);
|
);
|
||||||
#
|
#
|
||||||
@ -5108,7 +5107,6 @@ sub get_configuration( $$$$ ) {
|
|||||||
%used = ();
|
%used = ();
|
||||||
|
|
||||||
if ( have_capability 'CONNTRACK_MATCH') {
|
if ( have_capability 'CONNTRACK_MATCH') {
|
||||||
$globals{STATEMATCH} = '-m conntrack --ctstate';
|
|
||||||
$used{CONNTRACK_MATCH} = REQUIRED;
|
$used{CONNTRACK_MATCH} = REQUIRED;
|
||||||
} else {
|
} else {
|
||||||
$used{STATE_MATCH} = REQUIRED;
|
$used{STATE_MATCH} = REQUIRED;
|
||||||
|
@ -2283,7 +2283,7 @@ sub generate_matrix() {
|
|||||||
'' ,
|
'' ,
|
||||||
'' ,
|
'' ,
|
||||||
'insert' ,
|
'insert' ,
|
||||||
"$globals{STATEMATCH} NEW ";
|
state_match('NEW');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2609,7 +2609,7 @@ sub process_rule ( $$$$$$$$$$$$$$$$$$$ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fatal_error "$basictarget rules are not allowed in the $section_rmap{$section} SECTION" if $actiontype & ( NATRULE | NONAT );
|
fatal_error "$basictarget rules are not allowed in the $section_rmap{$section} SECTION" if $actiontype & ( NATRULE | NONAT );
|
||||||
$rule .= "$globals{STATEMATCH} ESTABLISHED " if $section == ESTABLISHED_SECTION;
|
$rule .= state_match('ESTABLISHED') if $section == ESTABLISHED_SECTION;
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# Generate CT rules(s), if any
|
# Generate CT rules(s), if any
|
||||||
|
@ -2446,7 +2446,7 @@ sub process_secmark_rule1( $$$$$$$$$ ) {
|
|||||||
if ( ( $state ||= '' ) ne '' ) {
|
if ( ( $state ||= '' ) ne '' ) {
|
||||||
my $state1;
|
my $state1;
|
||||||
fatal_error "Invalid STATE ( $state )" unless $state1 = $state{$state};
|
fatal_error "Invalid STATE ( $state )" unless $state1 = $state{$state};
|
||||||
$state = "$globals{STATEMATCH} $state1 ";
|
$state = state_match( $state1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
my $target = $secmark eq 'SAVE' ? 'CONNSECMARK --save' :
|
my $target = $secmark eq 'SAVE' ? 'CONNSECMARK --save' :
|
||||||
|
@ -41,7 +41,7 @@ use Shorewall::Rules;
|
|||||||
my ( $action ) = get_action_params( 1 );
|
my ( $action ) = get_action_params( 1 );
|
||||||
|
|
||||||
if ( my $check = check_state( 'ESTABLISHED' ) ) {
|
if ( my $check = check_state( 'ESTABLISHED' ) ) {
|
||||||
perl_action_helper( $action, $check == 1 ? "$globals{STATEMATCH} ESTABLISHED" : '', 'ESTABLISHED' );
|
perl_action_helper( $action, $check == 1 ? state_match('ESTABLISHED') : '', 'ESTABLISHED' );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -46,7 +46,7 @@ if ( supplied $audit ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( my $check = check_state( 'INVALID' ) ) {
|
if ( my $check = check_state( 'INVALID' ) ) {
|
||||||
perl_action_helper( $action, $check == 1 ? "$globals{STATEMATCH} INVALID" : '' , 'INVALID' );
|
perl_action_helper( $action, $check == 1 ? state_match( 'INVALID' ) : '' , 'INVALID' );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -41,7 +41,7 @@ use Shorewall::Rules;
|
|||||||
my ( $action ) = get_action_params( 1 );
|
my ( $action ) = get_action_params( 1 );
|
||||||
|
|
||||||
if ( my $check = check_state( 'NEW' ) ) {
|
if ( my $check = check_state( 'NEW' ) ) {
|
||||||
perl_action_helper( $action, $check == 1 ? "$globals{STATEMATCH} NEW" : '' , 'NEW' );
|
perl_action_helper( $action, $check == 1 ? state_match( 'NEW' ) : '' , 'NEW' );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -42,7 +42,7 @@ use Shorewall::Rules;
|
|||||||
my ( $action ) = get_action_params( 1 );
|
my ( $action ) = get_action_params( 1 );
|
||||||
|
|
||||||
if ( my $check = check_state( 'RELATED' ) ) {
|
if ( my $check = check_state( 'RELATED' ) ) {
|
||||||
perl_action_helper( $action, $check == 1 ? "$globals{STATEMATCH} RELATED" : '', 'RELATED' );
|
perl_action_helper( $action, $check == 1 ? state_match( 'RELATED' ) : '', 'RELATED' );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -41,7 +41,7 @@ use Shorewall::Rules;
|
|||||||
my ( $action ) = get_action_params( 1 );
|
my ( $action ) = get_action_params( 1 );
|
||||||
|
|
||||||
if ( my $check = check_state( 'UNTRACKED' ) ) {
|
if ( my $check = check_state( 'UNTRACKED' ) ) {
|
||||||
perl_action_helper( $action, $check == 1 ? "$globals{STATEMATCH} UNTRACKED" : '' , 'UNTRACKED' );
|
perl_action_helper( $action, $check == 1 ? state_match( 'UNTRACKED' ) : '' , 'UNTRACKED' );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user