Correct IPv6 address checking (again)

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-02-13 13:37:26 -08:00
parent 0461e5de20
commit 93b3fd9be5

View File

@ -648,14 +648,18 @@ sub resolve_6dnsname( $ ) {
sub validate_6net( $$ ) {
my ( $net, $allow_name ) = @_;
if ( $net =~ /^\[(.*)]$/ ) {
if ( $net =~ /^\[(.+)]$/ ) {
$net = $1;
} elsif ( $net =~ /^\[(.*)\]\/(\d+)$/ ) {
} elsif ( $net =~ /^\[(.+)\]\/(\d+)$/ ) {
$net = join( '/', $1, $2 );
}
fatal_error "Invalid Network Address($net)" if $net =~ /\[/;
($net, my $vlsm, my $rest) = split( '/', $net, 3 );
fatal_error 'Invalid Network Address(' . join( '/', $net, $vlsm, $rest ) if defined $rest;
if ( $net =~ /\+(\[?)/ ) {
if ( $1 ) {
fatal_error "An ipset list ($net) is not allowed in this context";