summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2001-10-30 12:30:05 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2001-10-30 12:30:05 +0000
commitc147918221a6ac1da3927ad9b9d9f89269bae5d1 (patch)
tree189f6a538ca18e4bc03fa0daea89f109d7c6db75
parent1bcb8391a8d0c1bfd8ade79b51a77c6cda4d16b9 (diff)
ddp_print needs aligned data (alpha,sparc). Noted (with a patch) by <jepeway@blasted-heath.com>. Patch code relocated inside ddp_print(). Fixes PR# 1945.
-rw-r--r--usr.sbin/tcpdump/print-atalk.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-atalk.c b/usr.sbin/tcpdump/print-atalk.c
index 7c8135b8a66..7ea8fa68554 100644
--- a/usr.sbin/tcpdump/print-atalk.c
+++ b/usr.sbin/tcpdump/print-atalk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-atalk.c,v 1.16 2000/10/31 16:06:48 deraadt Exp $ */
+/* $OpenBSD: print-atalk.c,v 1.17 2001/10/30 12:30:04 ho Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -25,7 +25,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-atalk.c,v 1.16 2000/10/31 16:06:48 deraadt Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-atalk.c,v 1.17 2001/10/30 12:30:04 ho Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -224,6 +224,22 @@ ddp_print(register const u_char *bp, register u_int length, register int t,
register u_short snet, register u_char snode, u_char skt)
{
+#ifdef LBL_ALIGN
+ if ((long)bp & 3) {
+ static u_char *abuf = NULL;
+
+ if (abuf == NULL) {
+ abuf = (u_char *)malloc(snaplen);
+ if (abuf == NULL)
+ error("ddp_print: malloc");
+ }
+ memcpy(abuf, bp, min(length, snaplen));
+ snapend += abuf - bp;
+ packetp = abuf;
+ bp = abuf;
+ }
+#endif
+
switch (t) {
case ddpNBP: