ipfw and bridge: unaligned payload pointers panicing perfectly performing MIPS boxes

Luigi Rizzo rizzo at iet.unipi.it
Tue Nov 23 15:41:32 UTC 2010


On Tue, Nov 23, 2010 at 02:30:56PM +0800, Adrian Chadd wrote:
> Hi everyone (and Luigi especially!)
> 
> I've found that enabling ipfw for bridge interfaces panics my MIPS
> boards. A bit of digging shows that the payload mbuf isn't aligned as
> passed into ipfw_chk(), and this is causing aligned access exceptions.
> 
> It likely isn't a problem on i386/ia64 because they are happy with
> unaligned access. :-)
> 
> I'm going to try and patch it locally by copying the mbuf payload into
> a new, temporary mbuf that's aligned; but I have no idea what the
> "right" solution for the stack is.
> 
> Ideas? :)

the copy (especially if you make it conditional on #if NEED_ALIGNED
and possibly on actual alignment)
sounds good enough and it probably limits the number of changes to code.
The drawback is that you might need to copy a lot of stuff unnecessarily.

The other option would be to replace all the initial assignments to the
copies of the header fields with macros, which then translate into
assignments or bcopy depending on the circumstances.

I'd go for the former, unless you are really concerned about performance.

cheers
luigi


More information about the freebsd-net mailing list