Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src correct LBL_ALIGN behavior, sync with tcpdump.org.
details: https://anonhg.NetBSD.org/src/rev/d2b73cec130e
branches: trunk
changeset: 538382:d2b73cec130e
user: itojun <itojun%NetBSD.org@localhost>
date: Fri Oct 18 23:13:57 2002 +0000
description:
correct LBL_ALIGN behavior, sync with tcpdump.org.
enable LBL_ALIGN codepath to use byte-by-byte fetch in extract.h.
should correct PR 18688/18398.
diffstat:
dist/tcpdump/print-atalk.c | 19 ++-----------------
dist/tcpdump/print-ip.c | 28 ++--------------------------
dist/tcpdump/print-ip6.c | 23 ++---------------------
usr.sbin/tcpdump/Makefile | 3 ++-
4 files changed, 8 insertions(+), 65 deletions(-)
diffs (150 lines):
diff -r 242d2a266ef8 -r d2b73cec130e dist/tcpdump/print-atalk.c
--- a/dist/tcpdump/print-atalk.c Fri Oct 18 23:06:33 2002 +0000
+++ b/dist/tcpdump/print-atalk.c Fri Oct 18 23:13:57 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print-atalk.c,v 1.4 2002/05/31 09:45:44 itojun Exp $ */
+/* $NetBSD: print-atalk.c,v 1.5 2002/10/18 23:13:57 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -29,7 +29,7 @@
static const char rcsid[] =
"@(#) Header: /tcpdump/master/tcpdump/print-atalk.c,v 1.71 2002/02/05 10:03:34 guy Exp (LBL)";
#else
-__RCSID("$NetBSD: print-atalk.c,v 1.4 2002/05/31 09:45:44 itojun Exp $");
+__RCSID("$NetBSD: print-atalk.c,v 1.5 2002/10/18 23:13:57 itojun Exp $");
#endif
#endif
@@ -201,21 +201,6 @@
ddpskt_string(dp->dstSkt));
bp += ddpSize;
length -= ddpSize;
-#ifdef LBL_ALIGN
- if ((long)bp & 3) {
- static u_char *abuf = NULL;
-
- if (abuf == NULL) {
- abuf = (u_char *)malloc(snaplen);
- if (abuf == NULL)
- error("atalk_print: malloc");
- }
- memcpy((char *)abuf, (char *)bp, min(length, snaplen));
- snapend += abuf - (u_char *)bp;
- packetp = abuf;
- bp = abuf;
- }
-#endif
ddp_print(bp, length, dp->type, snet, dp->srcNode, dp->srcSkt);
}
diff -r 242d2a266ef8 -r d2b73cec130e dist/tcpdump/print-ip.c
--- a/dist/tcpdump/print-ip.c Fri Oct 18 23:06:33 2002 +0000
+++ b/dist/tcpdump/print-ip.c Fri Oct 18 23:13:57 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print-ip.c,v 1.4 2002/05/31 09:45:45 itojun Exp $ */
+/* $NetBSD: print-ip.c,v 1.5 2002/10/18 23:13:57 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
static const char rcsid[] =
"@(#) Header: /tcpdump/master/tcpdump/print-ip.c,v 1.104 2002/05/29 09:47:04 guy Exp (LBL)";
#else
-__RCSID("$NetBSD: print-ip.c,v 1.4 2002/05/31 09:45:45 itojun Exp $");
+__RCSID("$NetBSD: print-ip.c,v 1.5 2002/10/18 23:13:57 itojun Exp $");
#endif
#endif
@@ -268,30 +268,6 @@
struct protoent *proto;
ip = (const struct ip *)bp;
-#ifdef LBL_ALIGN
- /*
- * If the IP header is not aligned, copy into abuf.
- */
- if ((long)ip & 3) {
- static u_char *abuf = NULL;
- static int didwarn = 0;
-
- if (abuf == NULL) {
- abuf = (u_char *)malloc(snaplen);
- if (abuf == NULL)
- error("ip_print: malloc");
- }
- memcpy((char *)abuf, (char *)ip, min(length, snaplen));
- snapend += abuf - (u_char *)ip;
- packetp = abuf;
- ip = (struct ip *)abuf;
- /* We really want libpcap to give us aligned packets */
- if (!didwarn) {
- warning("compensating for unaligned libpcap packets");
- ++didwarn;
- }
- }
-#endif
if ((u_char *)(ip + 1) > snapend) {
printf("[|ip]");
return;
diff -r 242d2a266ef8 -r d2b73cec130e dist/tcpdump/print-ip6.c
--- a/dist/tcpdump/print-ip6.c Fri Oct 18 23:06:33 2002 +0000
+++ b/dist/tcpdump/print-ip6.c Fri Oct 18 23:13:57 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print-ip6.c,v 1.3 2002/02/18 09:37:07 itojun Exp $ */
+/* $NetBSD: print-ip6.c,v 1.4 2002/10/18 23:13:57 itojun Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
@@ -27,7 +27,7 @@
static const char rcsid[] =
"@(#) Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.21 2001/11/16 02:17:36 itojun Exp";
#else
-__RCSID("$NetBSD: print-ip6.c,v 1.3 2002/02/18 09:37:07 itojun Exp $");
+__RCSID("$NetBSD: print-ip6.c,v 1.4 2002/10/18 23:13:57 itojun Exp $");
#endif
#endif
@@ -70,25 +70,6 @@
ip6 = (const struct ip6_hdr *)bp;
-#ifdef LBL_ALIGN
- /*
- * The IP6 header is not 16-byte aligned, so copy into abuf.
- */
- if ((u_long)ip6 & 15) {
- static u_char *abuf;
-
- if (abuf == NULL) {
- abuf = malloc(snaplen);
- if (abuf == NULL)
- error("ip6_print: malloc");
- }
- memcpy(abuf, ip6, min(length, snaplen));
- snapend += abuf - (u_char *)ip6;
- packetp = abuf;
- ip6 = (struct ip6_hdr *)abuf;
- bp = abuf;
- }
-#endif
TCHECK(*ip6);
if (length < sizeof (struct ip6_hdr)) {
(void)printf("truncated-ip6 %d", length);
diff -r 242d2a266ef8 -r d2b73cec130e usr.sbin/tcpdump/Makefile
--- a/usr.sbin/tcpdump/Makefile Fri Oct 18 23:06:33 2002 +0000
+++ b/usr.sbin/tcpdump/Makefile Fri Oct 18 23:13:57 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2002/09/18 03:54:38 lukem Exp $
+# $NetBSD: Makefile,v 1.30 2002/10/18 23:13:58 itojun Exp $
.include <bsd.own.mk>
@@ -60,6 +60,7 @@
-DHAVE_SETLINEBUF=1 -DHAVE_VSNPRINTF=1 -DHAVE_SNPRINTF=1 \
-DRETSIGTYPE=void -DRETSIGVAL= -DHAVE_SIGACTION=1 \
-DHAVE_SOCKADDR_SA_LEN=1 -DHAVE_H_ERRNO=1
+CPPFLAGS+=-DLBL_ALIGN=1
#CPPFLAGS+=-DTCPDUMP_DO_SMB=1
.if (${MKCRYPTO} != "no")
Home |
Main Index |
Thread Index |
Old Index