summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-07 13:40:27 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-07 13:40:27 +0000
commit0beea9d0f00073068026e76a11a6a9f7bd1a7e22 (patch)
tree8604043b5ea2d31c050c245954ecd0f98ec4bb3c
parentce7cf593ad87cfa42ce3c0d13ed7a13393144117 (diff)
gross BPF_HDR hack, do better
-rw-r--r--sys/net/bpf.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index 1b3427b61d8..03e18e8a360 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: bpf.h,v 1.2 1996/03/03 21:07:02 niklas Exp $ */
-/* $NetBSD: bpf.h,v 1.13 1996/02/13 21:59:58 christos Exp $ */
+/* $OpenBSD: bpf.h,v 1.3 1996/05/07 13:40:26 deraadt Exp $ */
+/* $NetBSD: bpf.h,v 1.14 1996/05/02 00:57:28 cgd Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -145,9 +145,18 @@ struct bpf_hdr {
* Because the structure above is not a multiple of 4 bytes, some compilers
* will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
* Only the kernel needs to know about it; applications use bh_hdrlen.
+ * XXX To save a few bytes on 32-bit machines, we avoid end-of-struct
+ * XXX padding by using the size of the header data elements. This is
+ * XXX fail-safe: on new machines, we just use the 'safe' sizeof.
*/
#ifdef _KERNEL
+#if defined(__arm32__) || defined(__i386__) || defined(__m68k__) || \
+ defined(__mips__) || defined(__ns32k__) || defined(__sparc__) || \
+ defined(__vax__)
#define SIZEOF_BPF_HDR 18
+#else
+#define SIZEOF_BPF_HDR sizeof(struct bpf_hdr)
+#endif
#endif
/*