develooper Front page | perl.perl5.porters | Postings from August 2001

Re: Adding IPv6 to Perl

Thread Previous | Thread Next
From:
Gisle Aas
Date:
August 17, 2001 15:41
Subject:
Re: Adding IPv6 to Perl
Message ID:
lrhev6b9co.fsf@caliper.ActiveState.com
Jeff Okamoto <okamoto@xfiles.corp.hp.com> writes:

> > > 1.  No changes to core of Perl.  The existing core networking functions
> > > will not be changed, and thus will not be IPv6-compatible.
> > 
> > This I don't get.  To me the existing core networking functions seems
> > to be totally IPv6-compatible.  You just pass them different kind of
> > structs.
> 
> Yes, that's true.  But because I don't want to change Perl's existing
> core, then we need different versions of connect, etc. that pass the
> correct structures.

The structs are just a sequence of bytes and the core perl functions
does not even look at them.  For instance 'pp_connect' is:

    addr = SvPV(addrsv, len);
    TAINT_PROPER("connect");
    if (PerlSock_connect(PerlIO_fileno(IoIFP(io)), (struct sockaddr *)addr, len) >= 0)
	RETPUSHYES;
    else
	RETPUSHUNDEF;

There is nothing here that knows about 'struct in_addr' for IPv4.  You
just pack the correct thing into the 'addrsv' argument and the right
stuff is eventually passed down to the OS-level connect().  This means
that there is no need to replace perl's connect() function for IPv6.

Regards,
Gisle

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About