diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index d610ab8c9..4fbe5c826 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -6324,7 +6324,7 @@ sub match_dest_net( $;$ ) { 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 "; } @@ -6405,7 +6405,7 @@ sub imatch_dest_net( $;$ ) { 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 ); } @@ -7528,6 +7528,11 @@ sub isolate_dest_interface( $$$$ ) { $rule .= "-d $variable "; } + } elsif ( $dest =~ /^\$/ ) { + # + # Runtime address variable + # + $dnets = $dest; } elsif ( $family == F_IPV4 ) { if ( $dest =~ /^(.+?):(.+)$/ ) { $diface = $1; diff --git a/Shorewall/Perl/Shorewall/Nat.pm b/Shorewall/Perl/Shorewall/Nat.pm index 0ff9f90bc..ca1cb469e 100644 --- a/Shorewall/Perl/Shorewall/Nat.pm +++ b/Shorewall/Perl/Shorewall/Nat.pm @@ -941,7 +941,15 @@ sub handle_nat_rule( $$$$$$$$$$$$$ ) { } else { $server = $1 if $family == F_IPV6 && $server =~ /^\[(.+)\]$/; 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; }