In message <[EMAIL PROTECTED]>, Bruce Evans writes:
>On Tue, 15 Oct 2002, Jeffrey Hsu wrote:
>
>>   > The side effect of having some source-files using the _IP_VHL hack and
>>   > some not is that sizeof(struct ip) varies from file to file, which at
>>   > best is confusing an at worst the source of some really evil bugs.
>
>There is no such effect, or ip would not work.

s/,/ with our current compilers and architectures,/

>>   > I would therefore propose to eliminate the _IP_VHL hack from the kernel
>>   > to end this state of (potential) confusion
>
>This would remove the least unportable version.

Could be, but there is no point in us having two different versions,
neither of which is guaranteed to be portable, in particular when
one of the two is private to FreeBSD and not even consistently used
there.

For reference:

        NetBSD hasn't got the _IP_VHL but has a __packed__ on the
        structure.

        OpenBSD hasn't got the _IP_VHL either, but hasn't adopted
        the __packed__ from NetBSD.

        Linux also uses bitfields and endianess #ifdefs.

>These workarounds are even more unportable than bit-fields.  However,
>there is no problem with struct ip yet, because everything is manually
>packed to work with "all" C compilers on "all" systems.  This will
>break on systems with 64-bit ints, since sizeof(struct ip) == 20 is
>not a multiple of 8.

Good point.

I'll ammend my proposal to include a __packed__ and a CTASSERT on
the size of struct ip == 20.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to