develooper Front page | perl.perl5.porters | Postings from June 2010

Re: [perl #75740] IPv6 support missing in perl5.10, perl5.12

Thread Previous | Thread Next
Nicholas Clark
June 15, 2010 08:45
Re: [perl #75740] IPv6 support missing in perl5.10, perl5.12
Message ID:
On Tue, Jun 15, 2010 at 10:00:26AM +0200, Rafael Garcia-Suarez wrote:
> On 14 June 2010 18:39, <> wrote:
> > What's missing in the CORE:
> > - getaddrinfo (gethostbyname gives only IPv4)
> > - inet_pton, inet_ntop (similar to inet_aton, inet_ntoa but also for
> >  IPv6)
> Note that Configure already probes for those functions.
> > - support for IPv6 in Net::* Modules (Net::SMTP, Net::FTP.. are bound to
> >  use IO::Socket::INET which does not do IPv6)
> > - comfortable use of sockets similar to IO::Socket::INET6
> >
> > What help could CPAN provide:
> > - Socket6 - which provides getaddrinfo, inet_ntop, inet_pton..
> I'd vote against : looking at it, its compilation process is too
> complex, it contains an incomplete implementation of getaddrinfo (used
> when the system has none), and its license is complex.
> We could provide instead a bare-bones module that just wraps around
> getaddrinfo, getnameinfo, inet_ntop and inet_pton (maybe other ones).
> What about the IP:: namespace for those ? (or we could also stuff them
> in POSIX::)

We added inet_ntop and inet_pton to Socket in March 2009:

Hence they are already in Socket 5.12
That leaves only getaddrinfo. What is wrong with also putting that in Socket?

> > - IO::Socket::INET6 which is similar to IO::Socket::INET but supports
> >  also IPv6
> It currently requires Socket6, which could be made optional.
> > - Net::INET6Glue, which is a hack to provide IPv6 functionality in the
> >  Net::* Modules, LWP...
> >
> > So what could be done?
> > I think it's not that hard:
> > - integrate Socket6 and IO::Socket::INET6 into CORE, complementing
> >  Socket and IO::Socket::INET
> > - integrate IPv6 in the Net::* CORE modules, thus making a lot of
> >  Net::INET6Glue obsolete. This is not hard, it's mostly using
> >  IO::Socket::INET6 instead of IO::Socket::INET if available. I did this
> >  with IO::Socket::SSL already, which is automatically IPv6 aware if
> >  IO::Socket::INET6 is available.
> >  The added functionality needed for Net::FTP can be used from
> >  Net::INET6Glue::FTP.
> For that you'd need to ask Graham Barr, maintainer of libnet on CPAN.
> The perl core just integrates the CPAN version. I personally like the
> idea. Graham ?

I think that this comes down to a policy/philosophy distinction.

  Socket is called Socket, not Socket4, and likewise NET::*, such as
  IO::Socket::INET being that, not IO::Socket::INET4
  Hence they're not just about IPv4, so *they* should be made to support
  IPv6 too (and no new namespaces)

  IPv6 is something new, and it is reasonable for programs to need to load
  new/different modules to support it.

Personally, I prefer the former. I'm not sure how hard it is to get there.
This means that I am disagreeing with the specific proposal to integrate
Socket6 and IO;:Socket::INET6 into the code.

Partly this is because I believe that it is viable (and not that hard) 
make this work in the core modules, without breaking the existing IPv6
specific modules on CPAN, such that existing code that loads them will
continue working, but new or updated code can be cleaner.

Nicholas Clark

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About