Allow DNS names in DEST column of a DNAT rule

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8076 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-01-17 19:02:40 +00:00
parent 99a5eba368
commit 3f4d773489
2 changed files with 14 additions and 2 deletions

View File

@ -69,10 +69,22 @@ sub valid_address( $ ) {
sub validate_address( $$ ) {
my ( $addr, $allow_name ) = @_;
my @addrs = ( $addr );
unless ( valid_address $addr ) {
fatal_error "Invalid IP Address ($addr)" unless $allow_name;
fatal_error "Unknown Host ($addr)" unless defined gethostbyname $addr;
fatal_error "Unknown Host ($addr)" unless (@addrs = gethostbyname $addr);
if ( defined wantarray ) {
shift @addrs for (1..4);
for ( @addrs ) {
my (@a) = unpack('C4',$_);
$_ = join('.', @a );
}
}
}
defined wantarray ? wantarray ? @addrs : $addrs[0] : undef;
}
sub validate_net( $$ ) {

View File

@ -1157,7 +1157,7 @@ sub process_rule1 ( $$$$$$$$$$$ ) {
if ( $server =~ /^(.+)-(.+)$/ ) {
validate_range( $1, $2 );
} else {
validate_address $server, 0;
$server = validate_address $server, 1;
}
if ( $action eq 'SAME' ) {