From owner-freebsd-net Wed Oct 16 1:16:55 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 4FA1737B401; Wed, 16 Oct 2002 01:16:54 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 81E3C43E77; Wed, 16 Oct 2002 01:16:53 -0700 (PDT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id g9G8GeIw069414; Wed, 16 Oct 2002 10:16:47 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Bruce Evans Cc: Jeffrey Hsu , net@FreeBSD.ORG, arch@FreeBSD.ORG Subject: Re: RFC: eliminating the _IP_VHL hack. In-Reply-To: Your message of "Wed, 16 Oct 2002 18:03:24 +1000." <20021016172019.W4358-100000@gamplex.bde.org> Date: Wed, 16 Oct 2002 10:16:40 +0200 Message-ID: <69413.1034756200@critter.freebsd.dk> From: Poul-Henning Kamp 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 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,/ >> > 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. For reference: NetBSD hasn't got the _IP_VHL but has a __packed__ on the structure. OpenBSD hasn't got the _IP_VHL either, but hasn't adopted the __packed__ from NetBSD. Linux also uses bitfields and endianess #ifdefs. >These workarounds are even more unportable than bit-fields. However, >there is no problem with struct ip yet, because everything is manually >packed to work with "all" C compilers on "all" systems. This will >break on systems with 64-bit ints, since sizeof(struct ip) == 20 is >not a multiple of 8. Good point. I'll ammend my proposal to include a __packed__ and a CTASSERT on the size of struct ip == 20. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message