On new architectures and on the alpha, define SIZEOF_BPF_HDR to be
sizeof(struct bpf_hdr). On machines that we currently support that can use the old definition (which just covers the size of the data in struct bpf_hdr), use it even though it's a hack. (This was changed for the 'new architectures' case so as to be fail-safe; BPF may waste a few bytes of space per captured packet on new architectures, but now at least it's more likely to work.)
This commit is contained in:
parent
8fcff43077
commit
4d6b6d9082
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bpf.h,v 1.13 1996/02/13 21:59:58 christos Exp $ */
|
||||
/* $NetBSD: bpf.h,v 1.14 1996/05/02 00:57:28 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993
|
||||
|
@ -144,9 +144,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
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue