From bdb673a64289cbb2ac7f0e3d60f99f3de5348988 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 23 Nov 2009 15:21:25 -0800 Subject: [PATCH] More IPv6 fixes --- Shorewall/Perl/Shorewall/IPAddrs.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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;