Bug#666651: Bug#667737: libnet-server-perl: no IPv4 server when binding to localhost

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Apr 6 20:27:36 UTC 2012


On 04/06/2012 04:03 PM, gregor herrmann wrote:
> On Fri, 06 Apr 2012 14:02:41 +0300, Niko Tyni wrote:
> 
>> Unfortunately libnet-server-perl currently only binds an IPv6 socket
>> when asked for 'localhost' if localhost is both 127.0.0.1 and ::1 in
>> /etc/hosts.  I think this is a bug. Consider a server:
>>
>>  # perl -MNet::Server -e 'package S; use base q/Net::Server/; sub process_request { print qq(hello, world!\n) }; S->run(port => 1600, host => q/localhost/)'
>>  2012/04/06-13:17:11 S (type Net::Server) starting! pid(3802)
>>  Using default listen value of 128
>>  Binding to TCP port 1600 on host localhost
>>  Group Not Defined.  Defaulting to EGID '1000 20 27 29 119 1000'
>>  User Not Defined.  Defaulting to EUID '1000'
>>
>> and a client:
>>
>>  # grep localhost /etc/hosts
>>  127.0.0.1   localhost
>>  ::1     localhost ip6-localhost ip6-loopback
>>
>>  # telnet 127.0.0.1 1600
>>  Trying 127.0.0.1...
>>  telnet: Unable to connect to remote host: Connection refused
>>
>>  # telnet localhost 1600
>>  Trying ::1...
>>  Connected to localhost.
>>  Escape character is '^]'.
>>  hello, world!
>>  Connection closed by foreign host.
>>
>> I'm cloning a bug about this. It's clearly Debian specific behaviour,
>> as the IPv6 support was patched in with 0.99-3. I think it's bad enough
>> to be considered release critical, but other pkg-perl folks should feel
>> free to downgrade if they disagree.
> 
> Ouch, that's indeed nasty.
> Could any of our more IPv6-savvy members (dkg? intrigeri?) take a look
> at this patch?

I have (on my list of things to do) a project to rewrite debian's
Net::Server IPv6 support without reference to Socket6 or
IO::Socket::INET6.  This would create a versioned dependency on
perl-modules for a recent version of Socket (i think 5.14 is needed),
but it would also reduce our dependencies on out-of-core modules, and it
is an opportunity to overhaul this code and get it Right if possible.

I already submitted a similar patch for HTTP::Server::Simple upstream
[0], so i've dug around in this space a bit.

At its core, there's a concern here that asking a server to bind to a
name might actually bind it to multiple addresses (since a name can have
multiple addresses).  I'm not convinced that Net::Server can be properly
made to bind to multiple addresses with a single "host" configuration,
but i agree that for the sake of congruity with the rest of the perl
world, Net::Server should preferentially bind to the IPv4 address if a
given name maps to both an IPv4 and an IPv6 address.

If folks feel like this would address the problem described in this
ticket, i'm happy to try to bump the Net::Server IPv6 overhaul up in my
queue.

I'd be happy to collaborate with anyone interested on it, of course.

	--dkg

[0] https://rt.cpan.org/Ticket/Display.html?id=61200#txn-1054169

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20120406/ed2febea/attachment.pgp>


More information about the pkg-perl-maintainers mailing list