More IPv6 fixes

This commit is contained in:
Tom Eastep 2009-11-23 15:21:25 -08:00
parent 1710f9ce7c
commit bdb673a642

View File

@ -485,12 +485,12 @@ sub valid_6address( $ ) {
return 0 unless ( @address == $max ) || $address =~ /::/;
return 0 if $address =~ /:::/ || $address =~ /::.*::/;
unless ( $address eq '::' ) {
unless ( $address =~ tr/:/:/ == 2 && ( $address =~ /^::/ || $address =~ /::$/ ) ) {
return 0 if $address =~ /^:/ || $address =~ /:$/;
}
for my $a ( @address ) {
return 0 unless $a eq '' || ( $a =~ /^[a-fA-f\d]+$/ && oct "0x$a" < 65536 );
}
for my $a ( @address ) {
return 0 unless $a eq '' || ( $a =~ /^[a-fA-f\d]+$/ && length $a < 5 );
}
1;