aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2010-12-13 23:15:43 +0000
committerMichael Scherer <misc@mageia.org>2010-12-13 23:15:43 +0000
commitf8bd2945ce571a80d00dde3fa2cb87c1610285f4 (patch)
treebde4fdea4f75855e5590078ce1a5fb4586cbe4cc
parent2886aa35c73bb42075f750c4df652cfea0768f2f (diff)
downloadidentity-f8bd2945ce571a80d00dde3fa2cb87c1610285f4.tar
identity-f8bd2945ce571a80d00dde3fa2cb87c1610285f4.tar.gz
identity-f8bd2945ce571a80d00dde3fa2cb87c1610285f4.tar.bz2
identity-f8bd2945ce571a80d00dde3fa2cb87c1610285f4.tar.xz
identity-f8bd2945ce571a80d00dde3fa2cb87c1610285f4.zip
- patch from Maarten Vanraes to fix the issue of keyprefix with ipv6
-rw-r--r--lib/CatDap/Controller/user.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/CatDap/Controller/user.pm b/lib/CatDap/Controller/user.pm
index abae4dd..5c58d48 100644
--- a/lib/CatDap/Controller/user.pm
+++ b/lib/CatDap/Controller/user.pm
@@ -114,8 +114,20 @@ sub auto : Private {
sub get_keyprefix : Private {
my ( $self, $c ) = @_;
- return sprintf("%02x%02x%02x",split /\./,$c->req->address);
+ 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 );
+ }
+ else {
+ $keyprefix = sprintf( "%02x%02x%02x", split /\./, $c->req->address );
+ }
+ return $keyprefix;
}
+
=head2 index
=cut