Subject: Re: status of the mbuf API SoC project
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 09/05/2006 10:59:06
>> Shouldn't a redesign of mtod also include a way to deal with the
>> alignment issue?  I've seen code all over the place that blindly
>> assumes a pointer returned from mtod is correctly aligned, something
>> which has bit me more than once.
> BTW how exactly have you been byten by that, considering that packet
> header structures are declared as __packed and don't require
> alignment?

I don't remember exact details; for too long now I've just made a
practice of always treating an mbuf as an unaligned byte buffer,
copying into and out of it as I would any other unaligned byte buffer.

I can only assume that either (a) my bad experiences predated the use
of __packed, or (b) my bad experiences were with structs other than
packet header structures.  (The horrible botch that is the CMSG_* stuff
comes to mind as a plausible candidate for (b) (ie, struct cmsghdr, and
control message data types, like int, that require alignment).)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B