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

John-Mark Gurney gurney_j at resnet.uoregon.edu
Thu Jun 16 18:25:15 GMT 2005


Daniel Hartmeier wrote this message on Thu, Jun 16, 2005 at 00:34 +0200:
> So, are you really sure we should do differently in pf, instead of
> looking for a bridge problem, where bridge constructs an mbuf with the
> IP header not properly aligned?
> 
> I.e. if the IP header is properly aligned within the mbuf (on 32-bit
> boundaries, I presume), wouldn't ip_src/dst have to be properly aligned
> as well, even though __packed is used, because the layout of struct ip
> is chosen like that?

This is a more general problem..  All of our ethernet drivers that run
on aligned platforms have special code to offset by 2 the ethernet
packet specificly so that struct ip and friends are properly aligned..
This is because the ethernet header is 14 bytes long, and if the data
was left unchanged, the struct ip would start at x mod 4 = 2...

of course, this is stupid, and each component that requires alignment
when accepting a packet from another interface (i.e. pf taking in an
mbuf from another system like bridge, or even the if stack) should use
the m_copyup function that I committed a bit back.. This will give you
correct alignment, and at the same time, make it continue to work
if/when we finally decide to not have the ethernet drivers align packets...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-net mailing list