Subject: Re: alignment crash in v6 ipfilter when receiving on gif
To: Chris Ross <cross+netbsd@distal.com>
From: Martin Husemann <martin@duskware.de>
List: port-sparc64
Date: 07/10/2007 16:13:58
On Tue, Jul 10, 2007 at 10:02:46AM -0400, Chris Ross wrote:
>   I guess I don't understand what you mean by "this kind of cast."   
> You mean the casts to i6addr_t* ?  So because i6addr_t is a 128-bit  
> sized object, the compiler assumes it's properly aligned?

Yes, I mean the cast to i6addr_t* - but it is not  because of it's size, but
because it contains elements requiring 64 bit alignment (e.g. void
*vptr[2];).

>   In that case, one of the suggestions in the thread was to put a 64- 
> bit value in the union ip6_ctlun that's contained in struct ip6_hdr.   
> This would make struct ip6_hdr 32 bits larger, but would align both  
> ip6_src and ip6_dst.

I have not looked at IPv6 code in detail, but I guess we'll have to live
with packets as they come from the wire, not how we like them to be
layed out in memory - I don't see how this could work.

Martin