forked from extern/shorewall_code
Unconditionally convert masq->snat
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
011322992e
commit
5e2f1f573d
@ -779,7 +779,7 @@ sub compiler {
|
|||||||
#
|
#
|
||||||
# Setup Masquerade/SNAT
|
# Setup Masquerade/SNAT
|
||||||
#
|
#
|
||||||
setup_snat( $update );
|
setup_snat;
|
||||||
#
|
#
|
||||||
# Setup Nat
|
# Setup Nat
|
||||||
#
|
#
|
||||||
|
@ -37,7 +37,7 @@ use strict;
|
|||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw( setup_nat setup_netmap add_addresses );
|
our @EXPORT = qw( setup_nat setup_netmap add_addresses );
|
||||||
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule process_one_masq convert_masq @addresses_to_add %addresses_to_add ) ] );
|
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule convert_masq @addresses_to_add %addresses_to_add ) ] );
|
||||||
our @EXPORT_OK = ();
|
our @EXPORT_OK = ();
|
||||||
|
|
||||||
Exporter::export_ok_tags('rules');
|
Exporter::export_ok_tags('rules');
|
||||||
@ -587,11 +587,11 @@ EOF
|
|||||||
# Convert a masq file into the equivalent snat file
|
# Convert a masq file into the equivalent snat file
|
||||||
#
|
#
|
||||||
sub convert_masq() {
|
sub convert_masq() {
|
||||||
|
my $have_masq_rules;
|
||||||
|
|
||||||
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
|
if ( my $fn = open_file( 'masq', 1, 1 ) ) {
|
||||||
my ( $snat, $fn1 ) = open_snat_for_output( $fn );
|
my ( $snat, $fn1 ) = open_snat_for_output( $fn );
|
||||||
|
|
||||||
my $have_masq_rules;
|
|
||||||
|
|
||||||
directive_callback(
|
directive_callback(
|
||||||
sub ()
|
sub ()
|
||||||
{
|
{
|
||||||
@ -647,6 +647,8 @@ sub convert_masq() {
|
|||||||
|
|
||||||
close $snat, directive_callback( 0 );
|
close $snat, directive_callback( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$have_masq_rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -5851,23 +5851,15 @@ sub process_snat( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Process the masq or snat file
|
# Process the snat file. Convert the masq file if found and non-empty
|
||||||
#
|
#
|
||||||
sub setup_snat( $ ) # Convert masq->snat if true
|
sub setup_snat()
|
||||||
{
|
{
|
||||||
my $fn;
|
my $fn;
|
||||||
my $have_masq;
|
|
||||||
|
|
||||||
if ( $_[0] ) {
|
unless ( convert_masq ) {
|
||||||
convert_masq();
|
|
||||||
} elsif ( $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(0), $have_masq = 1 while read_a_line( NORMAL_READ );
|
|
||||||
}
|
|
||||||
|
|
||||||
unless ( $have_masq ) {
|
|
||||||
#
|
#
|
||||||
# Masq file empty or didn't exist
|
# Masq file was empty or didn't exist
|
||||||
#
|
#
|
||||||
if ( $fn = open_file( 'snat', 1, 1 ) ) {
|
if ( $fn = open_file( 'snat', 1, 1 ) ) {
|
||||||
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty snat file" , 's'; } );
|
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , "a non-empty snat file" , 's'; } );
|
||||||
|
Loading…
Reference in New Issue
Block a user