Skip Menu |
Report information
Id: 123282
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: jns+bc [at]
rob [at]

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: Moar

Subject: IO::Socket::INET fails to connect if a resource is available over IPv6 and the client is misconfigured to use IPv6
Download (untitled) / with headers
text/plain 599b
I have a machine that gets IPv6 router advertisements, but IPv6 isn't correctly routed. When I run the following code:<>, :port(3000)) rakudo tries to connect to over IPv6, which doesn't work. When it doesn't work, it doesn't try IPv4; it just fails. If I specify the socket family:<>, :port(3000), :family(2)) # 2 is INET ...the family parameter is not respected. I've disabled IPv6 on the machine for the time being, but I figured that others might run into this situation.
Subject: [BUG] IO::Socket::INET uses IPV6 first without asking
Download (untitled) / with headers
text/plain 894b
Hi, the background for this is in It presumably hasn't been picked up earlier because no-one has tested on an IPV6 enabled network. It appears that if the network connection has IPV6 and the host has an AAAA record then IO::Socket::INET will attempt to connect first to the V6 address despite the family default being unchanged from PIO::SOCK_INET, if this attempt fails to connect (in the case in the bug report above, the server isn't listening on V6,) then the IPV4 isn't tried and the connection fails. I think that for least surprise it should probably only attempt to connect on the socket family request, however if the V6 behaviour is to stay it should attempt both V6 and V4 and only fail if it isn't able to create either connection. I might add I am personally not able to test on V6 just passing on a triaged 3rd party report.
There's actually a much simpler test for this and this was noticed in the wild as an issue against CheckSocket. If you you have an /etc/hosts that does something like: localhost ::1 localhost (Which seems to be perfectly valid - FreeBSD for instance will create a hosts file like this if it is configured for IPv6 as well as v4,) And you have some code that does something like: my $socket = => 'localhost', localport => $port, listen => True); loop { my $client = $socket.accept; } Then: => '', port => $port) Will fail, as will swapping the numeric IP and name in the server and client. Because you can't either specify the address family to be used, nor determine from the server socket which family it has been bound with there is no way to work around this which is somewhat unfortunate. I think this kind of thing is going to come up more often as people start making network applications.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at