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

Re: Adding IPv6 to Perl

Thread Previous
Jeff Okamoto
August 20, 2001 14:32
Re: Adding IPv6 to Perl
Message ID:
> > 	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:
>    #define sockaddr_storage sockaddr
> #endif
> and then use 'struct sockaddr_storage' where perl allocates sockadd
> storage like in pp_accept.

This looks fine too.


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