ia64/81284: Unaligned Reference with pf on 5.4/IA64

Pyun YongHyeon yongari at rndsoft.co.kr
Wed Jun 29 02:11:41 GMT 2005


On Tue, Jun 28, 2005 at 09:00:37PM +0000, Andrew Thompson wrote:
 > The following reply was made to PR ia64/81284; it has been noted by GNATS.
 > 
 > From: Andrew Thompson <thompsa at freebsd.org>
 > To: bug-followup at FreeBSD.org
 > Cc:  
 > Subject: Re: ia64/81284: Unaligned Reference with pf on 5.4/IA64
 > Date: Wed, 29 Jun 2005 08:50:18 +1200
 > 
 >  A complementary patch for bridge.c using the same macros and routines as
 >  if_bridge. As far as I can tell ipv6 isn't filtered.
 >  

I think your patch will work for bridge/if_bridge case. But it would
not fix other handlers that run at IP layer.
I guess it would also panic in pf/ipf/ipfw at IPv4/IPv6 pfil handler
when it was not processed by bridge/if_bridge. I believe developers
already know how to fix this specific issue but it's matter of how
to handle this kind of unaligned access efficiently.

I guess the root cause of the unaligned access comes from ethernet
driver. Most ethernet drivers(except em(4)) had aligned received
packet on architectures with strict alignment(em(4) with JUMBO frames
passes unaligned packet data to upper layer). So aligning the
packet data was one of big pain for driver writers on hardwares that
have DMA limitations. Using m_copyup(9) would greatly decrease the
burden on driver layer. In addition it wouldn't give additional
penalty on architectures that allows non-aligned access. However it
requires all packet handlers(bridge, pf/ipf/ipfw, netgraph, IPv4,
IPv6 etc) should check alignment right before accessing the data. That
would increase code size and duplication.
Personally I prefer handling of alignment in driver or ethernet layer
due to simplicity. Other developers may have different views.

-- 
Regards,
Pyun YongHyeon
http://www.kr.freebsd.org/~yongari	|	yongari at freebsd.org


More information about the freebsd-pf mailing list