Package: libio-socket-inet6-perl
Version: 2.54-1
Severity: important
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
While trying to find out why my apt-cacher doesn't connect to
ftp.at.debian.org (which is available both via IPv4 and IPv6) anymore
I stumbled about a weird behaviour in IO::Socket::INET6: If a host is
reachable over IPv6 the socket creation fails if Domain is specified
as AF_UNSPEC (which is the default).
The attached script produces the following output for me:
$ perl sock.pl
Trying to connect to www.google.com ...
... via unspecified ...
Success!
... via IPv6 ...
Error: IO::Socket::INET6: getaddrinfo: Name or service not known
... via IPv4 ...
Success!
Trying to connect to ipv6.google.com ...
... via unspecified ...
Error: IO::Socket::INET6: bind: Invalid argument
... via IPv6 ...
Success!
... via IPv4 ...
Error: IO::Socket::INET6: getaddrinfo: Name or service not known
Trying to connect to ftp.at.debian.org ...
... via unspecified ...
Error: IO::Socket::INET6: bind: Invalid argument
... via IPv6 ...
Success!
... via IPv4 ...
Success!
Trying to connect to www.sixxs.net ...
... via unspecified ...
Error: IO::Socket::INET6: bind: Invalid argument
... via IPv6 ...
Success!
... via IPv4 ...
Success!
That means:
AF_UNSPEC works for IPv4-only hosts (www.google.com) but fails for both
IPv6-only hosts (ipv6.google.com) and for hosts with both IPv4 and
IPv6 (ftp.at.debian.org and www.sixxs.net). AF_INET and AF_INET6 work
as expected.
Since apt-cacher has worked until ~1 week ago it's possible that this
problem in libio-socket-inet6-perl is triggered by something else,
but still the results are an important bug IMO.
Please tell me if there's anything else I should test or any
information I should provide.
Cheers,
gregor
- -- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'oldstable'), (500, 'experimental'),
(500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.29.200903251719
Locale: LANG=C, lc_ctype=de...@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash
Versions of packages libio-socket-inet6-perl depends on:
ii libsocket6-perl 0.20-1 (no description available)
ii perl 5.10.0-19 Larry Wall's Practical Extraction
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAknWo9wACgkQOzKYnQDzz+S5UwCgoRSl7AHo9YsmXAELuNMGGVz/
3ZoAoJ+B8q+3rXpf+y7wa6ZA4RxCrT2K
=sM35
-----END PGP SIGNATURE-----
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET6;
my @servers
= qw/www.google.com ipv6.google.com ftp.at.debian.org www.sixxs.net /;
my %protocols
= ( AF_INET, 'IPv4', AF_INET6, 'IPv6', AF_UNSPEC, 'unspecified' );
my $sock;
foreach my $server (@servers) {
print "Trying to connect to $server ...\n";
foreach my $protocol ( keys %protocols ) {
print "\t... via $protocols{$protocol} ...\n";
$sock = IO::Socket::INET6->new(
Domain => $protocol,
PeerAddr => $server,
PeerPort => 80,
Proto => 'tcp',
Multihomed => 1, # no effect
ReuseAddr => 1, # no effect
);
if ($@) {
print "\t\tError: $...@\n";
} else {
print "\t\tSuccess!\n";
}
}
}