From owner-freebsd-net Wed Oct 16 7:52:59 2002 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 7494537B401; Wed, 16 Oct 2002 07:52:57 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3712543EAA; Wed, 16 Oct 2002 07:52:56 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id AAA13232; Thu, 17 Oct 2002 00:52:43 +1000 Date: Thu, 17 Oct 2002 01:03:20 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Poul-Henning Kamp Cc: Jeffrey Hsu , , Subject: Re: RFC: eliminating the _IP_VHL hack. In-Reply-To: <69413.1034756200@critter.freebsd.dk> Message-ID: <20021017004627.O5865-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, 16 Oct 2002, Poul-Henning Kamp wrote: > In message <20021016172019.W4358-100000@gamplex.bde.org>, Bruce Evans writes: > >On Tue, 15 Oct 2002, Jeffrey Hsu wrote: > > > >> > The side effect of having some source-files using the _IP_VHL hack and > >> > some not is that sizeof(struct ip) varies from file to file, which at > >> > best is confusing an at worst the source of some really evil bugs. > > > >There is no such effect, or ip would not work. > > s/,/ with our current compilers and architectures,/ It is the non-_IP_VHL case that will break. The _IP_VHL case requires little more than the existence of uint8_t, which is now required by POSIX. > >> > I would therefore propose to eliminate the _IP_VHL hack from the kernel > >> > to end this state of (potential) confusion > > > >This would remove the least unportable version. > > Could be, but there is no point in us having two different versions, > neither of which is guaranteed to be portable, in particular when > one of the two is private to FreeBSD and not even consistently used > there. I agree that source oce portability is a problem and wasn't helped by not completing this change. > For reference: > > NetBSD hasn't got the _IP_VHL but has a __packed__ on the > structure. As you may know, I don't like gccisms like __packed__. NetBSD actually uses __attribute__(__packed__) like we used to in other places. Our __packed doesn't exactly help portability, since it is a syntax error on systems that don't #define it. > OpenBSD hasn't got the _IP_VHL either, but hasn't adopted > the __packed__ from NetBSD. > > Linux also uses bitfields and endianess #ifdefs. There are also an amazing number of unportable bit-fields in , and . The declarations of these don't even use endianness #ifdefs or __packed in most cases. Some unportabilities are avoided using the gcc extension of small bit-field types. > I'll ammend my proposal to include a __packed__ and a CTASSERT on > the size of struct ip == 20. I prefer just the CTASSERT until __packed is found to be necessary. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message