From owner-freebsd-net@FreeBSD.ORG Thu Apr 28 20:59:07 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 AEF8016A4CE for ; Thu, 28 Apr 2005 20:59:07 +0000 (GMT) Received: from diehard.n-r-g.com (diehard.n-r-g.com [62.48.3.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFBEF43D1D for ; Thu, 28 Apr 2005 20:59:06 +0000 (GMT) (envelope-from cjeker@diehard.n-r-g.com) Received: (qmail 12907 invoked by uid 1001); 28 Apr 2005 20:59:07 -0000 Date: Thu, 28 Apr 2005 22:58:45 +0159 From: Claudio Jeker To: freebsd-net@freebsd.org, net@freebsd.org Message-ID: <20050428205907.GB9606@diehard.n-r-g.com> Mail-Followup-To: Claudio Jeker , freebsd-net@freebsd.org, net@freebsd.org References: <20050428135120.GB21428@cell.sick.ru> <427111BF.2050607@savvis.net> <42712BAA.4070201@elischer.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42712BAA.4070201@elischer.org> User-Agent: Mutt/1.5.8i Subject: Re: if_tap unaligned access problem X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2005 20:59:07 -0000 On Thu, Apr 28, 2005 at 11:30:02AM -0700, Julian Elischer wrote: > > > Maksim Yevmenkin wrote: > > >Hello, > > > >>A quick question about if_tap, the tapwrite function > >>( which copies an ethernet frame into an mbuf using uiotombuf ) > >>is broken on alpha and sparc64. > >>The 14 byte ethernet header causes the rest of the frame to > >>be misaligned on 4 byte boundaries. This causes crashes in > >>various other parts of the kernel. The solution would be to > >>shift the mbuf by two bytes, but I am not quite sure where > >>this should happen. > > > > > >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 > > > >/sys/kern/uipc_syscalls.c > >/sys/net/if_tap.c > >/sys/net/if_tun.c > >/sys/netgraph/ng_device.c > > > I think we should defien a MAC header that looks like: > char dummy[2] > char dest[6] > char src[6] > char type_len[2] > and make ether net cards start writing 2 bytes into the buffer :-) > There seems to be a reason that a function like m_adj() and ETHER_ALIGN exists. -- :wq Claudio