Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jun 2005 11:25:02 -0700
From:      John-Mark Gurney <gurney_j@resnet.uoregon.edu>
To:        Daniel Hartmeier <daniel@benzedrine.cx>
Cc:        freebsd-net@freebsd.org, Marcel Moolenaar <marcel@freebsd.org>, freebsd-pf@freebsd.org, Marcel Moolenaar <marcel@xcllnt.net>
Subject:   Re: ia64/81284: Unaligned Reference with pf on 5.4/IA64
Message-ID:  <20050616182502.GL742@funkthat.com>
In-Reply-To: <20050615223450.GY8526@insomnia.benzedrine.cx>
References:  <200506132123.j5DLNove069255@freefall.freebsd.org> <20050615204232.GX8526@insomnia.benzedrine.cx> <df7cf0532ee7aa367a11ff455ffecae1@xcllnt.net> <20050615223450.GY8526@insomnia.benzedrine.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050616182502.GL742>