mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-12 08:38:14 +01:00
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:
parent
99a5eba368
commit
3f4d773489
@ -69,11 +69,23 @@ sub valid_address( $ ) {
|
|||||||
sub validate_address( $$ ) {
|
sub validate_address( $$ ) {
|
||||||
my ( $addr, $allow_name ) = @_;
|
my ( $addr, $allow_name ) = @_;
|
||||||
|
|
||||||
|
my @addrs = ( $addr );
|
||||||
|
|
||||||
unless ( valid_address $addr ) {
|
unless ( valid_address $addr ) {
|
||||||
fatal_error "Invalid IP Address ($addr)" unless $allow_name;
|
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( $$ ) {
|
sub validate_net( $$ ) {
|
||||||
my ($net, $vlsm, $rest) = split( '/', $_[0], 3 );
|
my ($net, $vlsm, $rest) = split( '/', $_[0], 3 );
|
||||||
|
@ -1157,7 +1157,7 @@ sub process_rule1 ( $$$$$$$$$$$ ) {
|
|||||||
if ( $server =~ /^(.+)-(.+)$/ ) {
|
if ( $server =~ /^(.+)-(.+)$/ ) {
|
||||||
validate_range( $1, $2 );
|
validate_range( $1, $2 );
|
||||||
} else {
|
} else {
|
||||||
validate_address $server, 0;
|
$server = validate_address $server, 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $action eq 'SAME' ) {
|
if ( $action eq 'SAME' ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user