Fixes for IPv6 DNAT

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-02-26 10:24:25 -08:00
parent 45d53bdb1d
commit 78babf0941

View File

@ -690,10 +690,16 @@ sub handle_nat_rule( $$$$$$$$$$$$ ) {
validate_range( $1, $2 ); validate_range( $1, $2 );
} else { } else {
my ( $addr1, $addr2 ) = ( $1, $2 ); my ( $addr1, $addr2 ) = ( $1, $2 );
$addr1 = $1 if $addr1 =~ /^\[(.+)\]$/;
$addr2 = $1 if $addr2 =~ /^\[(.+)\]$/; if ( $server =~ /^\[(.+)\]$/ ) {
$server = $1;
fatal_error "Correct address range syntax is '[<addr1>-<addr2>]'" if $server =~ /]-\[/;
assert( $server =~ /^(.+)-(.+)$/ );
( $addr1, $addr2 ) = ( $1, $2 );
}
validate_range( $addr1, $addr2 ); validate_range( $addr1, $addr2 );
$server = join '-', $addr1, $addr2 $server = join( '-', $addr1, $addr2 );
} }
} else { } else {
unless ( $server eq ALLIP ) { unless ( $server eq ALLIP ) {
@ -713,7 +719,6 @@ sub handle_nat_rule( $$$$$$$$$$$$ ) {
} }
} else { } else {
for my $serv ( split /,/, $server ) { for my $serv ( split /,/, $server ) {
$serv =~ s/-/]-[/; #In case this is a range.
$target .= " --to-destination [${serv}]${serverport}"; $target .= " --to-destination [${serv}]${serverport}";
} }
} }