From owner-freebsd-net@FreeBSD.ORG Thu Apr 28 16:40:40 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 964B916A4CE; Thu, 28 Apr 2005 16:40:40 +0000 (GMT) Received: from mailgate1b.savvis.net (mailgate1b.savvis.net [216.91.182.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id F0AE643D2D; Thu, 28 Apr 2005 16:40:39 +0000 (GMT) (envelope-from Maksim.Yevmenkin@savvis.net) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate1b.savvis.net (Postfix) with ESMTP id 4CB913BFFD; Thu, 28 Apr 2005 11:40:39 -0500 (CDT) Received: from mailgate1b.savvis.net ([127.0.0.1]) by localhost (mailgate1b.savvis.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 05138-01-93; Thu, 28 Apr 2005 11:40:39 -0500 (CDT) Received: from out002.email.savvis.net (out002.apptix.savvis.net [216.91.32.45]) by mailgate1b.savvis.net (Postfix) with ESMTP id 1AF8F3BFEA; Thu, 28 Apr 2005 11:40:39 -0500 (CDT) Received: from s228130hz1ew171.apptix-01.savvis.net ([10.146.4.29]) by out002.email.savvis.net with Microsoft SMTPSVC(6.0.3790.211); Thu, 28 Apr 2005 11:40:05 -0500 Received: from [10.254.186.111] ([66.35.239.94]) by s228130hz1ew171.apptix-01.savvis.net with Microsoft SMTPSVC(6.0.3790.211); Thu, 28 Apr 2005 11:39:35 -0500 Message-ID: <427111BF.2050607@savvis.net> Date: Thu, 28 Apr 2005 09:39:27 -0700 From: Maksim Yevmenkin User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20040822 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gleb Smirnoff References: <20050428135120.GB21428@cell.sick.ru> In-Reply-To: <20050428135120.GB21428@cell.sick.ru> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 28 Apr 2005 16:39:35.0623 (UTC) FILETIME=[DCB90D70:01C54C10] X-Virus-Scanned: amavisd-new at savvis.net cc: Sten Spans cc: net@FreeBSD.org 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 16:40:40 -0000 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 > If_tun which is almost the same code has no such problem because > it lacks the 14 byte ethernet header. Openbsd has a combined > tun/tap driver, with some alignment hacks to fix this. yes, that is true. > Should I create a pr for this problem, or is there a simple > quick fix possible ? you probably should file pr. (1) and (2) above are quick fixes. (3) is more complicated and, maybe, not desirable. max