#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.77 2000-10-03 02:26:53 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.81 2000-12-23 20:55:22 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include <ctype.h>
#include <unistd.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
#include "interface.h"
#include "addrtoname.h"
#include "extract.h"
#include "tcp.h"
#include "ip.h"
+#ifdef INET6
+#include "ip6.h"
+#endif
static void print_tcp_rst_data(register const u_char *sp, u_int length);
sum += *sp++;
if (tlen & 1) {
- sum += htons( (*(const char *)sp) << 8);
+ sum += htons( (*(const u_int8_t *)sp) << 8);
}
while (sum > 0xffff)
sum += *sp++;
if (tlen & 1)
- sum += htons((*(const char *)sp) << 8);
+ sum += htons((*(const u_int8_t *)sp) << 8);
while (sum > 0xffff)
sum = (sum & 0xffff) + (sum >> 16);
void
tcp_print(register const u_char *bp, register u_int length,
- register const u_char *bp2)
+ register const u_char *bp2, int fragmented)
{
register const struct tcphdr *tp;
register const struct ip *ip;
tp = (struct tcphdr *)bp;
ip = (struct ip *)bp2;
#ifdef INET6
- if (ip->ip_v == 6)
+ if (IP_V(ip) == 6)
ip6 = (struct ip6_hdr *)bp2;
else
ip6 = NULL;
return;
}
- if (ip->ip_v == 4 && vflag) {
+ if (IP_V(ip) == 4 && vflag && !fragmented) {
int sum;
if (TTEST2(tp->th_sport, length)) {
sum = tcp_cksum(ip, tp, length);
}
}
#ifdef INET6
- if (ip->ip_v == 6 && ip6->ip6_plen && vflag) {
+ if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
int sum;
if (TTEST2(tp->th_sport, length)) {
sum = tcp6_cksum(ip6, tp, length);