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

Re: Adding IPv6 to Perl

Thread Previous
From:
Jeff Okamoto
Date:
August 20, 2001 14:32
Subject:
Re: Adding IPv6 to Perl
Message ID:
200108202132.OAA16773@xfiles.corp.hp.com
> > 	Size of struct sockaddr_in is 16 bytes
> > 	Size of struct sockaddr_un is 94 bytes
> > 	Size of struct sockaddr_in6 is 28 bytes
> > 	Size of struct sockaddr is 16 bytes
> > 	Size of struct sockaddr_storage is 256 bytes
> > 
> > The sockaddr_storage structure is new to IPv6, and is supposed to be
> > "large enough to accomodate all supported protocol-specific address
> > structures".  Unfortunately, this is is only declared on nodes that
> > have IPv6.
> 
> Do you know the rationale for not simply extending 'struct sockaddr'
> instead of introducing 'struct sockaddr_storage'?  What kind of code
> would break if 'struct sockaddr' grew?

I can only assume so that any programs that assumed sockaddr_in and
sockaddr were the same size would continue to work.  RFC 2553bis00
mentions this, but does not explicitly say this was why sockaddr_storage
was created.

> How about simply making this:
> 
> #ifndef HAS_SOCKADDR_STORAGE
>    #define sockaddr_storage sockaddr
> #endif
> 
> and then use 'struct sockaddr_storage' where perl allocates sockadd
> storage like in pp_accept.

This looks fine too.

Thanks,
Jeff

Thread Previous


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