Subject: | IO::Socket fails when IPv4 hostname appears after IPv6 hostname |
We're playing with enabling IPv6 support, and I've found an interesting
bug in IO::Socket I thought I'd let others be aware of. If in your
/etc/hosts file, the IPv6 addresses are listed prior to the IPv4 host
address, IO::Socket will time out. For example, if I have:
127.0.0.1 localhost
::1 localhost
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix
ff02::1 ipv6-allnodes
ff02::2 ipv6-allrouters
10.11.12.13 myipv4-host.name.domain myipv4-host
IP::Socket will fail when used by Net::LDAP
If I move the 10.11.12.13 address prior to all of the IPv6 pieces, it
works fine. Other IPv4 tools work without issue. So if you see weird
behavior out of Net::LDAP on IPv6 enabled systems even if you are only
dealing with IPv4, this may be the cause.
The problem has to do with the hostname. Specifying a URI of
ldap://<hostname>:389/ fails. Specifying a URI with the IPv4 address
works. So something is broken in how IO::Socket is determining the IPv4
address for the hostname.