diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2014-12-09 17:03:20 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2014-12-09 17:03:20 +0000 |
commit | bf0394b83f492c00dfc2efc515f19722039c72a1 (patch) | |
tree | c2985b98fb107c259ffb9432f591b31bfdbfa6e6 /usr.sbin/tcpdump | |
parent | 784e9bbdbec81a7767678045fabb36370abcb9e0 (diff) |
Catch up with the BPF_ALIGNMENT switch to the uint32_t.
bpf aligns data following the datalink header (e.g. ethernet)
on the BPF_ALIGNMENT boundary. Since rev1.41 of bpf.h it's
uint32_t instead of a long. And also since then almost all
packets become "unaligned" from the tcpdump perspective and
require costly copies into the internal buffer. Neither IP
header (struct ip) nor IPv6 (struct ip6_hdr) have fields
larger than 32 bits and therefore alignment requirements for
them are at most 32 bit.
ok millert, jsg, deraadt
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/print-ip.c | 4 | ||||
-rw-r--r-- | usr.sbin/tcpdump/print-ip6.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/print-ip.c b/usr.sbin/tcpdump/print-ip.c index 11c183ace1e..604f45aa652 100644 --- a/usr.sbin/tcpdump/print-ip.c +++ b/usr.sbin/tcpdump/print-ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip.c,v 1.41 2014/12/03 13:22:18 mikeb Exp $ */ +/* $OpenBSD: print-ip.c,v 1.42 2014/12/09 17:03:19 mikeb Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -370,7 +370,7 @@ ip_print(register const u_char *bp, register u_int length) * This will never happen with BPF. It does happen with raw packet * dumps from -r. */ - if ((intptr_t)ip & (sizeof(long)-1)) { + if ((intptr_t)ip & (sizeof(u_int32_t)-1)) { static u_char *abuf = NULL; static int didwarn = 0; int clen = snapend - bp; diff --git a/usr.sbin/tcpdump/print-ip6.c b/usr.sbin/tcpdump/print-ip6.c index c41973d768e..f9c851a2c23 100644 --- a/usr.sbin/tcpdump/print-ip6.c +++ b/usr.sbin/tcpdump/print-ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ip6.c,v 1.19 2014/12/03 13:22:18 mikeb Exp $ */ +/* $OpenBSD: print-ip6.c,v 1.20 2014/12/09 17:03:19 mikeb Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994 @@ -72,7 +72,7 @@ ip6_print(register const u_char *bp, register u_int length) * This will never happen with BPF. It does happen with * raw packet dumps from -r. */ - if ((intptr_t)ip6 & (sizeof(long)-1)) { + if ((intptr_t)ip6 & (sizeof(u_int32_t)-1)) { static u_char *abuf = NULL; static int didwarn = 0; int clen = snapend - bp; |