diff options
author | assar <assar> | 2000-07-11 01:14:41 +0000 |
---|---|---|
committer | assar <assar> | 2000-07-11 01:14:41 +0000 |
commit | b487688fc8aef62e50317102bc422d27d1eeb66a (patch) | |
tree | 3c29e48bfb47002313cfbfe0afb6a095a8d62528 /print-ip6.c | |
parent | 1b918881d88bdba52aa8db45192463590537c953 (diff) | |
download | tcpdump-b487688fc8aef62e50317102bc422d27d1eeb66a.tar.gz |
(ip6_print): rewrite the alignment code to be for v6 and not v4.
based on a patch from Love <lha@stacken.kth.se>
Diffstat (limited to 'print-ip6.c')
-rw-r--r-- | print-ip6.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/print-ip6.c b/print-ip6.c index c3e8309c..afa1db74 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.7 2000-07-11 00:55:22 assar Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.8 2000-07-11 01:14:41 assar Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -69,19 +69,19 @@ ip6_print(register const u_char *bp, register int length) #ifdef LBL_ALIGN /* - * The IP header is not word aligned, so copy into abuf. + * The IP6 header is not 16-byte aligned, so copy into abuf. * This will never happen with BPF. It does happen raw packet * dumps from -r. */ - if ((int)ip & (sizeof(long)-1)) { + if ((int)ip & 15) { static u_char *abuf; - if (abuf == 0) - abuf = (u_char *)malloc(snaplen); - bcopy((char *)ip, (char *)abuf, min(length, snaplen)); - snapend += abuf - (u_char *)ip; + if (abuf == NULL) + abuf = malloc(snaplen); + memcpy(ip6, abuf, min(length, snaplen)); + snapend += abuf - (u_char *)ip6; packetp = abuf; - ip = (struct ip6_hdr *)abuf; + ip6 = (struct ip6_hdr *)abuf; } #endif if ((u_char *)(ip6 + 1) > snapend) { |