From owner-freebsd-pf@FreeBSD.ORG Thu Jun 16 18:25:15 2005 Return-Path: X-Original-To: freebsd-pf@freebsd.org Delivered-To: freebsd-pf@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F17A716A41C; Thu, 16 Jun 2005 18:25:14 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (gate.funkthat.com [69.17.45.168]) by mx1.FreeBSD.org (Postfix) with ESMTP id A60E243D48; Thu, 16 Jun 2005 18:25:14 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (iijogh@localhost.funkthat.com [127.0.0.1]) by hydrogen.funkthat.com (8.13.3/8.13.3) with ESMTP id j5GIP4gb066863; Thu, 16 Jun 2005 11:25:04 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.13.3/8.13.3/Submit) id j5GIP2Hx066862; Thu, 16 Jun 2005 11:25:02 -0700 (PDT) (envelope-from jmg) Date: Thu, 16 Jun 2005 11:25:02 -0700 From: John-Mark Gurney To: Daniel Hartmeier Message-ID: <20050616182502.GL742@funkthat.com> Mail-Followup-To: Daniel Hartmeier , Marcel Moolenaar , freebsd-net@freebsd.org, Marcel Moolenaar , freebsd-pf@freebsd.org References: <200506132123.j5DLNove069255@freefall.freebsd.org> <20050615204232.GX8526@insomnia.benzedrine.cx> <20050615223450.GY8526@insomnia.benzedrine.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050615223450.GY8526@insomnia.benzedrine.cx> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 5.4-RELEASE-p1 i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html Cc: freebsd-net@freebsd.org, Marcel Moolenaar , freebsd-pf@freebsd.org, Marcel Moolenaar Subject: Re: ia64/81284: Unaligned Reference with pf on 5.4/IA64 X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John-Mark Gurney List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2005 18:25:15 -0000 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."