Subject: | problem in IO::Socket::SSL 1.956 for servers with multiple IPv4 addresses |
Date: | Mon, 11 Nov 2013 11:04:14 +0100 |
To: | bug-IO-Socket-SSL [...] rt.cpan.org |
From: | Torsten.Werner [...] assyst.de |
Hi,
the method "configure" contains the following sequence:
if ( $can_ipv6 && ! $arg_hash->{Domain} &&
! ( $arg_hash->{LocalAddr} || $arg_hash->{LocalHost} ) &&
(my $peer = $arg_hash->{PeerAddr} ||
$arg_hash->{PeerHost})) {
# set Domain to AF_INET/AF_INET6 if there is only one
choice
($peer, my $port) = IO::Socket::INET6::_sock_info(
$peer,$arg_hash->{PeerPort},6 );
my @res = Socket6::getaddrinfo(
$peer,$port,AF_UNSPEC,SOCK_STREAM );
if (@res == 5) { # <--- this is not true for servers with
more then one addresses
$arg_hash->{Domain} = $res[0];
DEBUG(2,'set domain to '.$res[0] );
}
}
the problem is the result of Socket6::getaddrinfo.
This function may return arrays with 5, 10, 15, ... members depending on
the number of IP addresses of the host.
The following would fix it:
if ( $can_ipv6 && ! $arg_hash->{Domain} &&
! ( $arg_hash->{LocalAddr} || $arg_hash->{LocalHost} ) &&
(my $peer = $arg_hash->{PeerAddr} ||
$arg_hash->{PeerHost})) {
# set Domain to AF_INET/AF_INET6 if there is only one
choice
($peer, my $port) = IO::Socket::INET6::_sock_info(
$peer,$arg_hash->{PeerPort},6 );
my @res = Socket6::getaddrinfo(
$peer,$port,AF_UNSPEC,SOCK_STREAM );
unless (scalar(@res) % 5) {
INFO: while (scalar(my @_res=splice(@res,0,5))) {
$arg_hash->{Domain} = $_res[0];
DEBUG(2,'set domain to '.$_res[0] );
last INFO if $_res[0]==23;
}
}
}
Bye
Torsten
----------------------------------------------------------------------
Assyst GmbH
Dr. Ing. Torsten Werner
Product Manager plan.assyst
Max-Planck-Str. 3
85609 Aschheim-Dornach
Germany
Phone: +49 (0)89 90505-0
Fax: +49 (0)89 90505-271
E-Mail: torsten.werner@assyst.de
Internet: http://www.assyst.de
Geschäftsführer: Dr. Andreas Seidl
Eingetragen beim Registergericht München HRB 180174
Sitz der Gesellschaft: 85609 Aschheim-Dornach
----------------------------------------------------------------------