Skip Menu |

This queue is for tickets about the Net-LDAP-Server-Test CPAN distribution.

Report information
The Basics
Id: 116304
Status: resolved
Priority: 0/
Queue: Net-LDAP-Server-Test

People
Owner: Nobody in particular
Requestors: rt.cpan [...] sartak.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.20
Fixed in: (no value)



Subject: [PATCHES] Improve IPv6 support
Hi Peter, I'm trying to install Net::LDAP::Server::Test and just about every test fails out with "Connection refused". I've determined (after lots of blood sweat and tears :)) that the problem is not in fact any firewall blockade, as hinted at in the README, but instead a matter of IPv4 vs IPv6 support. In short, Net::LDAP prefers to use IPv6 where available (using IO::Socket 0.20+ then IO::Socket::INET6): https://metacpan.org/source/MARSCHAP/perl-ldap-0.65/lib/Net/LDAP.pm#L32 https://metacpan.org/source/MARSCHAP/perl-ldap-0.65/lib/Net/LDAP.pm#L153 But, Net::LDAP::Server::Test is hardcoded to use IPv4 (by its use of IO::Socket::INET): https://metacpan.org/source/KARMAN/Net-LDAP-Server-Test-0.20/lib/Net/LDAP/Server/Test.pm#L923 https://metacpan.org/source/KARMAN/Net-LDAP-Server-Test-0.20/lib/Net/LDAP/Server/Test.pm#L1043 This means that in certain configurations, Net::LDAP (connecting with IPv6) cannot connect to Net::LDAP::Server::Test (listening on IPv4). For a more concrete example, setting up a standalone Net::LDAP::Server::Test instance and trying to connect to it with "nc" fails using IPv6, but succeeds when using IPv4, like so: $ nc -v 127.0.0.1 10636 Connection to 127.0.0.1 10636 port [tcp/*] succeeded! $ nc -4v localhost 10636 Connection to localhost 10636 port [tcp/*] succeeded! $ nc -v ::1 10636 nc: connect to ::1 port 10636 (tcp) failed: Connection refused $ nc -6v localhost 10636 nc: connect to localhost port 10636 (tcp) failed: Connection refused I'm submitting two pull requests to your GitHub repo. What you merge is up to you, but I don't think merging both would make much sense. The first PR (ipv4-loopback-address) switches the tests from using "localhost" to "127.0.0.1". This should fix the symptom by forcing use of the IPv4 stack. It's a less invasive change, but unfortunately it doesn't help anyone downstream whose own tests specify "localhost" as documented in Net::LDAP::Server::Test. The other (prefer-ipv6) switches the server from using IPv4 exclusively to preferring IPv6 where available, in the 100% exact same way that Net::LDAP does, which means they should always be able to connect. I left t/03-socket.t using the IPv4 stack to continue exercising that behavior. Thanks very much! Shawn
Thanks, Shawn. I ended up releasing a modified version of your 2nd patch with the CAN_IPV6 constant. I found in my local testing (OS X 10.9.5, perl 5.20.0) that IO::Socket::IP caused the tests to hang. When I switched to picking either ::INET or ::INET6 directly, it worked ok. I've just pushed 0.21 to PAUSE. Let me know if you see other problems. cheers, pek
Hi pek, On Tue Jul 19 10:20:09 2016, KARMAN wrote: Show quoted text
> I've just pushed 0.21 to PAUSE. Let me know if you see other problems.
0.21 works on my system. Thanks! Show quoted text
> cheers, > pek
Best, Shawn