Move Masq file processing to the Rules module

- This will enable supporting actions in the new snat file

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-10-14 12:42:58 -07:00
parent 289825a76f
commit 44477d97ac
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
2 changed files with 20 additions and 16 deletions

View File

@ -36,8 +36,8 @@ use Shorewall::Providers qw( provider_realm );
use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule ) ] );
our @EXPORT = qw( setup_nat setup_netmap add_addresses );
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule process_one_masq @addresses_to_add %addresses_to_add ) ] );
our @EXPORT_OK = ();
Exporter::export_ok_tags('rules');
@ -82,7 +82,7 @@ sub process_one_masq1( $$$$$$$$$$$ )
$inlinematches = get_inline_matches(0);
} else {
$inlinematches = get_inline_matches(0);
}
}
#
# Handle early matches
#
@ -402,19 +402,6 @@ sub process_one_masq( )
}
}
#
# Process the masq file
#
sub setup_masq()
{
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty masq file" , 's'; } );
process_one_masq while read_a_line( NORMAL_READ );
}
}
#
# Validate the ALL INTERFACES or LOCAL column in the NAT file
#

View File

@ -57,6 +57,7 @@ our @EXPORT = qw(
perl_action_tcp_helper
check_state
process_reject_action
setup_masq
);
our @EXPORT_OK = qw( initialize process_rule );
@ -5161,4 +5162,20 @@ sub process_mangle_rule( $ ) {
}
}
################################################################################
# Code moved from the Nat module in Shorewall 5.0.14 #
################################################################################
#
# Process the masq file
#
sub setup_masq()
{
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty masq file" , 's'; } );
process_one_masq while read_a_line( NORMAL_READ );
}
}
1;