From 44477d97ac417e7f266f166593c3c9e50fa53964 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 14 Oct 2016 12:42:58 -0700 Subject: [PATCH] Move Masq file processing to the Rules module - This will enable supporting actions in the new snat file Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Nat.pm | 19 +++---------------- Shorewall/Perl/Shorewall/Rules.pm | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Nat.pm b/Shorewall/Perl/Shorewall/Nat.pm index 4e3366f54..97b92758f 100644 --- a/Shorewall/Perl/Shorewall/Nat.pm +++ b/Shorewall/Perl/Shorewall/Nat.pm @@ -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 # diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index d61520ed7..c8394eb05 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -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;