From owner-freebsd-net@FreeBSD.ORG Fri Apr 29 18:28:26 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1FA5D16A4CE for ; Fri, 29 Apr 2005 18:28:26 +0000 (GMT) Received: from mail21.sea5.speakeasy.net (mail21.sea5.speakeasy.net [69.17.117.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2CD7343D46 for ; Fri, 29 Apr 2005 18:28:25 +0000 (GMT) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 4055 invoked from network); 29 Apr 2005 18:28:24 -0000 Received: from gate.funkthat.com (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail21.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 29 Apr 2005 18:28:23 -0000 Received: from hydrogen.funkthat.com (qjylqn@localhost.funkthat.com [127.0.0.1])j3TISMmo096530; Fri, 29 Apr 2005 11:28:23 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id j3TISJa5096529; Fri, 29 Apr 2005 11:28:19 -0700 (PDT) Date: Fri, 29 Apr 2005 11:28:19 -0700 From: John-Mark Gurney To: Maksim Yevmenkin Message-ID: <20050429182819.GP2670@funkthat.com> Mail-Followup-To: Maksim Yevmenkin , Sten Spans , Sam Leffler , Julian Elischer , net@freebsd.org References: <20050428135120.GB21428@cell.sick.ru> <427111BF.2050607@savvis.net> <42712BAA.4070201@elischer.org> <42715269.3010306@errno.com> <4272743A.2030003@savvis.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4272743A.2030003@savvis.net> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE 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: Sten Spans cc: net@freebsd.org cc: Julian Elischer cc: Sam Leffler Subject: Re: if_tap unaligned access problem X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2005 18:28:26 -0000 Maksim Yevmenkin wrote this message on Fri, Apr 29, 2005 at 10:51 -0700: > [...] > > >>>>i think we have few options here: > >>>> > >>>>1) revert back original tapwrite function that was changed in v. > >>>>1.48 and set offset to 2 bytes in top mbuf > >>>> > >>>>2) change current version of tapwrite so it would m_prepend and > >>>>m_pullup mbuf after m_uiotombuf > >>>> > >>>>3) change m_uiotombuf to accept one more parameter - mbuf offset at > >>>>which data should be copied. there are not that many users of > >>>>m_uiotombuf > > please find and review the attached patch (untested) that implements > option (3) above. > > >I could try to port the changes netbsd made using m_copyup and > >send you the resulting patchfile. IPv4 has already been serviced by > >John-Mark Gurney in perforce. > > having these changes in the tree is a good thing, but it will require > more testing. maybe for now we could get away with simpler changes? > @@ -1342,12 +1342,15 @@ > total = min(uio->uio_resid, len); > else > total = uio->uio_resid; > + if (align >= MHLEN) > + goto nospace; > if (total > MHLEN) Shouldn't this check be total + align > MHLEN? > m_final = m_getcl(how, MT_DATA, M_PKTHDR); > else > m_final = m_gethdr(how, MT_DATA); > if (m_final == NULL) > goto nospace; > + m_adj(m_final, align); > m_new = m_final; > while (progress < total) { > length = total - progress; -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."