diff --git a/Shorewall/Perl/Shorewall/IPAddrs.pm b/Shorewall/Perl/Shorewall/IPAddrs.pm index 7458a0f41..1e962d165 100644 --- a/Shorewall/Perl/Shorewall/IPAddrs.pm +++ b/Shorewall/Perl/Shorewall/IPAddrs.pm @@ -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;