Fix second bug regarding ADD_IP_ALIASES=Yes

Signed-off-by: Tom Eastep <teastep@shorewall.net>

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9823 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-04-07 03:22:16 +00:00
parent eb533d8b00
commit b6053d8577

View File

@ -388,11 +388,7 @@ sub do_one_nat( $$$$$ )
fatal_error "Invalid nat file entry" unless defined $interface && defined $internal; fatal_error "Invalid nat file entry" unless defined $interface && defined $internal;
if ( $add_ip_aliases ) { if ( $add_ip_aliases ) {
if ( defined( $alias ) && $alias eq '' ) { $add_ip_aliases = '' if defined( $alias ) && $alias eq '';
$add_ip_aliases = '';
} else {
emit "del_ip_addr $external $interface" unless $config{RETAIN_ALIASES};
}
} }
validate_nat_column 'ALL INTERFACES', \$allints; validate_nat_column 'ALL INTERFACES', \$allints;
@ -494,11 +490,17 @@ sub setup_netmap() {
sub add_addresses () { sub add_addresses () {
if ( @addresses_to_add ) { if ( @addresses_to_add ) {
my $arg = ''; my $arg = '';
my $addresses = 0;
while ( @addresses_to_add ) { while ( @addresses_to_add ) {
my $addr = shift @addresses_to_add; my $addr = shift @addresses_to_add;
my $interface = shift @addresses_to_add; my $interface = shift @addresses_to_add;
$arg = "$arg $addr $interface"; $arg = "$arg $addr $interface";
unless ( $config{RETAIN_ALIASES} ) {
emit '' unless $addresses++;
$interface =~ s/:.*//;
emit "del_ip_addr $addr $interface";
}
} }
emit "\nadd_ip_aliases $arg"; emit "\nadd_ip_aliases $arg";