From owner-freebsd-net@FreeBSD.ORG Fri Jun 6 07:40:13 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 65DEB106566B for ; Fri, 6 Jun 2008 07:40:13 +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 2B7368FC0C for ; Fri, 6 Jun 2008 07:40:13 +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 5E3B3112E71; Fri, 6 Jun 2008 03:40:12 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 06 Jun 2008 03:40:12 -0400 X-Sasl-enc: dvB8Gvl395xe5cW172gANP8OjXxbrSwO3fwBW4/SSoX4 1212738012 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 B6EAADF6E; Fri, 6 Jun 2008 03:40:11 -0400 (EDT) Message-ID: <4848E9DA.8090802@FreeBSD.org> Date: Fri, 06 Jun 2008 08:40:10 +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> <20080605155646.GC6864@epsilon.local> <200806060930.28527.marc.loerner@hob.de> In-Reply-To: <200806060930.28527.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, Rui Paulo 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: Fri, 06 Jun 2008 07:40:13 -0000 Marc L=F6rner wrote: > th_x2 and th_off are created as a bitfield. But C-Standard says that bi= tfields=20 > are accessed as integers =3D> 4-bytes > > On itanium integers are read with ld4-command but the address of th_x2/= th_off=20 > may not be aligned to 4-bytes =3D> we get an unaligned reference fault.= > > If we'd change to 1 byte-accesses =3D> I won't get any misaligned fault= s=20 > anymore. > =20 It's worth noting that Linux implements its version of tcphdr using a=20 32-bit-wide bitfield and the TCP header flags live there as bits instead = of as integer quantities. I think it should be OK to change the u_int to a uint8_t as NetBSD has.=20 The problem with bitfields in "signed char" is that they can become=20 unintentionally sign extended on a read, and for many years compilers=20 only supported "char", not "unsigned char". Does anyone see a reason why we should not make this change?