Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2002 18:23:22 -0700
From:      Jeffrey Hsu <hsu@FreeBSD.org>
To:        Poul-Henning Kamp <phk@freebsd.org>
Cc:        net@freebsd.org, arch@freebsd.org
Subject:   Re: RFC: eliminating the _IP_VHL hack.
Message-ID:  <0H41001UNVU5KX@mta5.snfc21.pbi.net>
In-Reply-To: Message from Poul-Henning Kamp <phk@freebsd.org> "of Wed, 16 Oct 2002 00:17:13 %2B0200." <60637.1034720233@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
  > 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.

  > I would therefore propose to eliminate the _IP_VHL hack from the kernel
  > to end this state of (potential) confusion

This problem could be solved more easily by changing the u_int back
to an u_char, as it used to be before rev 1.15:

Index: ip.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip.h,v
retrieving revision 1.19
diff -u -r1.19 ip.h
--- ip.h	14 Dec 2001 19:37:32 -0000	1.19
+++ ip.h	16 Oct 2002 01:15:48 -0000
@@ -51,11 +51,11 @@
 	u_char	ip_vhl;			/* version << 4 | header length >> 2 */
 #else
 #if BYTE_ORDER == LITTLE_ENDIAN
-	u_int	ip_hl:4,		/* header length */
+	u_char	ip_hl:4,		/* header length */
 		ip_v:4;			/* version */
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
-	u_int	ip_v:4,			/* version */
+	u_char	ip_v:4,			/* version */
 		ip_hl:4;		/* header length */
 #endif
 #endif /* not _IP_VHL */

But, if we were to pick one or the other to discard, I would keep the
IP_VHL because that field really is a byte in the IP header


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0H41001UNVU5KX>