forked from extern/shorewall_code
Allow runtime address variables as the server IP in DNAT rules
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
72293883dd
commit
1a2647618e
@ -6324,7 +6324,7 @@ sub match_dest_net( $;$ ) {
|
|||||||
return '-d ' . record_runtime_address $1, $2;
|
return '-d ' . record_runtime_address $1, $2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$net = validate_net $net, 1;
|
$net = validate_net $net, 1 unless $net =~ /^\$/; # Don't validate if runtime address variable
|
||||||
$net eq ALLIP ? '' : "-d $net ";
|
$net eq ALLIP ? '' : "-d $net ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6405,7 +6405,7 @@ sub imatch_dest_net( $;$ ) {
|
|||||||
return ( d => record_runtime_address( $1, $2, 1 ) );
|
return ( d => record_runtime_address( $1, $2, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$net = validate_net $net, 1;
|
$net = validate_net $net, 1 unless $net =~ /^\$/; # Don't validate if runtime address variable
|
||||||
$net eq ALLIP ? () : ( d => $net );
|
$net eq ALLIP ? () : ( d => $net );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7528,6 +7528,11 @@ sub isolate_dest_interface( $$$$ ) {
|
|||||||
|
|
||||||
$rule .= "-d $variable ";
|
$rule .= "-d $variable ";
|
||||||
}
|
}
|
||||||
|
} elsif ( $dest =~ /^\$/ ) {
|
||||||
|
#
|
||||||
|
# Runtime address variable
|
||||||
|
#
|
||||||
|
$dnets = $dest;
|
||||||
} elsif ( $family == F_IPV4 ) {
|
} elsif ( $family == F_IPV4 ) {
|
||||||
if ( $dest =~ /^(.+?):(.+)$/ ) {
|
if ( $dest =~ /^(.+?):(.+)$/ ) {
|
||||||
$diface = $1;
|
$diface = $1;
|
||||||
|
@ -941,7 +941,15 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) {
|
|||||||
} else {
|
} else {
|
||||||
$server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/;
|
$server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/;
|
||||||
fatal_error "Invalid server IP address ($server)" if $server eq ALLIP || $server eq NILIP;
|
fatal_error "Invalid server IP address ($server)" if $server eq ALLIP || $server eq NILIP;
|
||||||
my @servers = validate_address $server, 1;
|
|
||||||
|
my @servers;
|
||||||
|
|
||||||
|
if ( ( $server =~ /^([&%])(.+)/ ) ) {
|
||||||
|
@servers = ( record_runtime_address( $1, $2 ) );
|
||||||
|
} else {
|
||||||
|
@servers = validate_address $server, 1;
|
||||||
|
}
|
||||||
|
|
||||||
$server = join ',', @servers;
|
$server = join ',', @servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user