Skip to content

Commit

Permalink
fix _update_peer for IPv6 (wrong use of getnameinfo)
Browse files Browse the repository at this point in the history
  • Loading branch information
noxxi committed Aug 23, 2015
1 parent 00858d8 commit 6a98f0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/IO/Socket/SSL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ sub _update_peer {
my $sockaddr = getpeername( $self );
my $af = sockaddr_family($sockaddr);
if( CAN_IPV6 && $af == AF_INET6 ) {
my ($host, $port) = getnameinfo($sockaddr,
my (undef, $host, $port) = getnameinfo($sockaddr,
NI_NUMERICHOST | NI_NUMERICSERV);
$arg_hash->{PeerAddr} = $host;
$arg_hash->{PeerPort} = $port;
Expand Down

2 comments on commit 6a98f0f

@bluhm
Copy link
Contributor

@bluhm bluhm commented on 6a98f0f Aug 31, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getnameinfo from Socket.pm returns ($err, $hostname, $servicename).
The same function from Socket6.pm returns ($host, $port). As you
try to import from both modules, you shoud figure out which return
type is used here.

@noxxi
Copy link
Owner Author

@noxxi noxxi commented on 6a98f0f Sep 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out this ugly difference in behavior. Worked around it in 2.019 3f9b660.

Please sign in to comment.