Re: [perl #75630] IO::Socket does not provide the IPV6_V6ONLY constant

[email protected] (Paul LeoNerd Evans)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On Thu, Jun 10, 2010 at 09:29:10AM +0100, Nicholas Clark wrote:
> I'm not certain either. The counter argument is that Socket is called
> Socket, not Socket4, and (I think) is intended to provide general
> functionality, not just IPv4.

Ah; a fair point.

> Plus, I think (and I'm assuming a rough consensus here, until proven
> otherwise) the perl core should be shipping complete IPv6 functionality
> (well, as complete as it currently ships IPv4).

Would be nice. ;) See e.g. my repeated attempts to get my
Socket::GetAddrInfo module into core; or something like it (original bug
report was using it).

> I right in guessing that without this constant exposed *somewhere* by a
> module shipping in the perl core, we'd not meet that goal?

Complicated.

There's two camps in IPv6 land; those who say 'v6 is an extension of
'v4, and those who don't. Some OSes take the view that bind()ing a
PF_INET6 to an AF_INET6 TCP port, say, should also grab the IPv4 one as
well. Some don't.

Those in the former camp do a single

  socket(PF_INET6,...) && bind(..., pack_sockaddr_in6())

to grab both. Those in the latter camp do two

  socket(AF_INET6,...) && bind(..., pack_sockaddr_in6())
  socket(AF_INET, ...) && bind(..., pack_sockaddr_in())

The IPV6_BINDV6ONLY sockopt was an attempt to appease both camps - to
allow mixed v4+6 stacks to perform either behaviour, for various
programs written to one style or the other, by setting that option to
what they'd prefer.

We don't -strictly- need it, as any application can attempt to create
both sockets, and if binding the AF_INET one fails on EADDRINUSE, it's
likely because the AF_INET6 was already in place.

But perhaps it's a good idea to provide it anyway...

-- 
Paul "LeoNerd" Evans

[email protected]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/
signature.asc (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iD8DBQFMEMKLvLS2TC8cBo0RAinUAKDqn5gYlZ7z40jr/Jc+XOnUVzYDaQCeLUVO
Dhy0xhMGchaWk87hZQGoLRM=
=ZcSI
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.