You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@attglobal.net> on 2003/09/17 16:23:48 UTC

Re: cvs commit: apr/include apr_network_io.h

jorton@apache.org wrote:

> jorton      2003/09/17 07:19:17
> 
>   Modified:    include  apr_network_io.h
>   Log:
>   Move the 'sa' field to the end of the structure, to ensure
>   binary compatibility between a libapr built with IPv6 support
>   and one built without.

good move!

one of my evil twins considered allocating the socket address separately

the other one wondered about putting some reserved space in front of the 
sa union in case we need more fields later, but that may be problematic 
since apps can build the structure themself

on another topic...  what about binary compatibility regardless of large 
file support :)



Re: cvs commit: apr/include apr_network_io.h

Posted by Joe Orton <jo...@manyfish.co.uk>.
On Wed, Sep 17, 2003 at 10:23:48AM -0400, Jeff Trawick wrote:
> jorton@apache.org wrote:
> 
> >jorton      2003/09/17 07:19:17
> >
> >  Modified:    include  apr_network_io.h
> >  Log:
> >  Move the 'sa' field to the end of the structure, to ensure
> >  binary compatibility between a libapr built with IPv6 support
> >  and one built without.
> 
> good move!

>From talking to some guys at work this isn't actually good enough, when
the size of 'sa' changes its offset may also change because of alignment
requirements.

> one of my evil twins considered allocating the socket address separately

Another idea is to add a sockaddr_storage into the union to make sure
it's a fixed size on platforms which have sockaddr_storage regardless of
APR_HAVE_IPV6. I like that or dynamic allocation...

Using dynamic allocation means tweaking lots of code, and it would be
hard for an app to be source-compatible with 1.0 and 0.9.x unless we
added icky macros to both.

Using sockaddr_storage means the APR ABI is still vulnerable to change
across different versions of a particular platform, though I'm not sure
if I care too much about that, so I'm swaying towards using
sockaddr_storage.

> the other one wondered about putting some reserved space in front of the 
> sa union in case we need more fields later, but that may be problematic 
> since apps can build the structure themself
>
> on another topic...  what about binary compatibility regardless of large 
> file support :)

I'm planning to look at it soon :)

joe

ps. mind the hurricane

Re: cvs commit: apr/include apr_network_io.h

Posted by Colm MacCarthaigh <co...@stdlib.net>.
on a semi-related note (read: I've lost the original thread), 
we've tracked down the full source of the sizeof(sockaddr_in6) !=
 ai_addrlen bug on Tru64 , turns out it's a compiler alignment 
problem affecting some versions of Tru64 cc, and a lot of versions of 
gcc. 

They were mis-aligning the in6_addr union, but only at certain
offsets within other aligned structures (in this case sockaddr_in6).

It may still be worth adding the autoconf check for sizeof == ai_addrlen
to warn people about broken compilers, but the need for voodoo
overlaying has gone away.

On Wed, Sep 17, 2003 at 10:23:48AM -0400, Jeff Trawick wrote:
> >  Modified:    include  apr_network_io.h
> >  Log:
> >  Move the 'sa' field to the end of the structure, to ensure
> >  binary compatibility between a libapr built with IPv6 support
> >  and one built without.
> 
> good move!
> 
> one of my evil twins considered allocating the socket address separately
> 
> the other one wondered about putting some reserved space in front of the 
> sa union in case we need more fields later, but that may be problematic 
> since apps can build the structure themself
> 
> on another topic...  what about binary compatibility regardless of large 
> file support :)
> 
> 
> 

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net
colm@stdlib.net					  http://www.stdlib.net/