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.
This commit is contained in:
parent
7dd8880e90
commit
c025861aba
19
dist/tcpdump/print-atalk.c
vendored
19
dist/tcpdump/print-atalk.c
vendored
@ -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 @@ atalk_print(register const u_char *bp, u_int length)
|
||||
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);
|
||||
}
|
||||
|
||||
|
28
dist/tcpdump/print-ip.c
vendored
28
dist/tcpdump/print-ip.c
vendored
@ -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 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
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;
|
||||
|
23
dist/tcpdump/print-ip6.c
vendored
23
dist/tcpdump/print-ip6.c
vendored
@ -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_print(register const u_char *bp, register u_int length)
|
||||
|
||||
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);
|
||||
|
@ -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 @@ CPPFLAGS+= \
|
||||
-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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user