From owner-freebsd-net@FreeBSD.ORG Thu Jun 5 16:09:12 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12FBF1065673 for ; Thu, 5 Jun 2008 16:09:12 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id E04D78FC16 for ; Thu, 5 Jun 2008 16:09:11 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 50A5B112094; Thu, 5 Jun 2008 12:09:11 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 05 Jun 2008 12:09:11 -0400 X-Sasl-enc: miiA9Gx+281s71nW7B6xJaycIauVCfQDuht+5px+MlGO 1212682151 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id CEA022C7FE; Thu, 5 Jun 2008 12:09:10 -0400 (EDT) Message-ID: <48480FA5.3020800@FreeBSD.org> Date: Thu, 05 Jun 2008 17:09:09 +0100 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.14 (X11/20080514) MIME-Version: 1.0 To: =?ISO-8859-1?Q?Marc_L=F6rner?= References: <200806051712.47048.marc.loerner@hob.de> In-Reply-To: <200806051712.47048.marc.loerner@hob.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Cc: freebsd-net@freebsd.org Subject: Re: Probable Bug in tcp.h X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 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, 05 Jun 2008 16:09:12 -0000 Marc L=F6rner wrote: > .. > First of all I have the problam of misalignment of th_off. Because in t= his way=20 > always 4 bytes are read and the the bits of th_off are replaced. Then t= he 4=20 > bytes are written back.=20 > > But should (th_x and th_off) not only be 1 byte in whole -> only read a= nd=20 > write 1 byte? > =20 Which machine architecture are you attempting to compile this code on? On FreeBSD Tier 1 platforms, the access is probably going to come out of = L2 cache anyway, so the fields in question will be read by a burst cycle.= It is worth noting that NetBSD changed the base type of tcphdr's=20 bitfields to uint8_t, however this shuffles the compiler dependency into = the treatment of the "char" type. Most modern C compilers support=20 "unsigned char".