Deleted Added
full compact
21c21
< * $FreeBSD: head/contrib/tcpdump/print-ip6.c 57278 2000-02-17 03:30:04Z fenner $
---
> * $FreeBSD: head/contrib/tcpdump/print-ip6.c 75118 2001-04-03 07:50:46Z fenner $
26c26
< "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.2.2.1 2000/01/11 06:58:25 fenner Exp $";
---
> "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.16 2000/11/17 19:08:15 itojun Exp $";
41,46d40
< #include <netinet/in_systm.h>
< #include <netinet/ip.h>
< #include <netinet/ip_var.h>
< #include <netinet/udp.h>
< #include <netinet/udp_var.h>
< #include <netinet/tcp.h>
49d42
< #ifdef __STDC__
51d43
< #endif
52a45
> #include <string.h>
57c50
< #include <netinet/ip6.h>
---
> #include "ip6.h"
66c59
< register int hlen;
---
> register int advance;
69a63
> int fragmented = 0;
74c68
< #ifdef TCPDUMP_ALIGN
---
> #ifdef LBL_ALIGN
76c70
< * The IP header is not word aligned, so copy into abuf.
---
> * The IP6 header is not 16-byte aligned, so copy into abuf.
80c74
< if ((int)ip & (sizeof(long)-1)) {
---
> if ((u_long)ip6 & 15) {
83,86c77,80
< 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(abuf, ip6, min(length, snaplen));
> snapend += abuf - (u_char *)ip6;
88c82
< ip = (struct ip6_hdr *)abuf;
---
> ip6 = (struct ip6_hdr *)abuf;
99c93
< hlen = sizeof(struct ip6_hdr);
---
> advance = sizeof(struct ip6_hdr);
102c96
< if (length < len + hlen)
---
> if (length < len + advance)
104c98
< len + hlen - length);
---
> len + advance - length);
109c103
< cp += hlen;
---
> cp += advance;
119c113
< hlen = hbhopt_print(cp);
---
> advance = hbhopt_print(cp);
123c117
< hlen = dstopt_print(cp);
---
> advance = dstopt_print(cp);
127,128c121,122
< hlen = frag6_print(cp, (const u_char *)ip6);
< if (snapend <= cp + hlen)
---
> advance = frag6_print(cp, (const u_char *)ip6);
> if (snapend <= cp + advance)
130a125
> fragmented = 1;
133c128
< hlen = rt6_print(cp, (const u_char *)ip6);
---
> advance = rt6_print(cp, (const u_char *)ip6);
138c133
< (const u_char *)ip6);
---
> (const u_char *)ip6, fragmented);
142c137
< (const u_char *)ip6);
---
> (const u_char *)ip6, fragmented);
148c143
< hlen = ah_print(cp, (const u_char *)ip6);
---
> advance = ah_print(cp, (const u_char *)ip6);
154c149
< cp += esp_print(cp, (const u_char *)ip6, &enh);
---
> advance = esp_print(cp, (const u_char *)ip6, &enh);
166c161
< cp += ipcomp_print(cp, (const u_char *)ip6, &enh);
---
> advance = ipcomp_print(cp, (const u_char *)ip6, &enh);
171a167,170
>
> #ifndef IPPROTO_PIM
> #define IPPROTO_PIM 103
> #endif