Eliminate globals{STATEMATCH}

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-07-01 16:01:57 -07:00
parent 6803ce5d41
commit 18e7e43b2f
10 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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;

View File

@ -2283,7 +2283,7 @@ sub generate_matrix() {
'' , '' ,
'' , '' ,
'insert' , 'insert' ,
"$globals{STATEMATCH} NEW "; state_match('NEW');
} }
} }
} }

View File

@ -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

View File

@ -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' :

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;