diff options
-rw-r--r-- | lib/CatDap/Controller/user.pm | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/CatDap/Controller/user.pm b/lib/CatDap/Controller/user.pm index e6cc7a1..8c14cfd 100644 --- a/lib/CatDap/Controller/user.pm +++ b/lib/CatDap/Controller/user.pm @@ -116,11 +116,9 @@ sub get_keyprefix : Private { my ( $self, $c ) = @_; my $keyprefix; if ($c->req->address =~ m/:/) { - my $address = $c->req->address; - $address =~ s/\[\]://; - - # if we shift right 104 bits from 128 we have 24 bits left or 3 bytes. - $keyprefix = sprintf( "%06x", $address >> 104 ); + # For IPv6 the first 3 can be special and shared by many people, + # bytes 6-8 are more interesting + $keyprefix = sprintf( "%02x%02x%02x", splice(5, 3, split /:/, $c->req->address)); } else { $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address ); |