[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-net
Subject:    Re: ipfw and bridge: unaligned payload pointers panicing perfectly
From:       Luigi Rizzo <rizzo () iet ! unipi ! it>
Date:       2010-11-23 15:38:24
Message-ID: 20101123153824.GB48018 () onelab2 ! iet ! unipi ! it
[Download RAW message or body]

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
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic