diff options
author | fenner <fenner> | 2002-07-28 04:14:21 +0000 |
---|---|---|
committer | fenner <fenner> | 2002-07-28 04:14:21 +0000 |
commit | a71d112b5c898951be91480f193dce7101727d2d (patch) | |
tree | ce7227eee6c510def89caad6a6c9239011f5c544 /print-tcp.c | |
parent | dc97370ce2efb3b5841eb6db755ef955a6eba937 (diff) | |
download | tcpdump-a71d112b5c898951be91480f193dce7101727d2d.tar.gz |
Calculate UDP/TCP pseudo-checksum properly in the presence of
source-route options.
Diffstat (limited to 'print-tcp.c')
-rw-r--r-- | print-tcp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/print-tcp.c b/print-tcp.c index 1f57dfcf..0d924dea 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.96 2002-07-21 20:56:24 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.97 2002-07-28 04:14:22 fenner Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -122,7 +122,10 @@ static int tcp_cksum(register const struct ip *ip, phu.ph.mbz = 0; phu.ph.proto = IPPROTO_TCP; memcpy(&phu.ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t)); - memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t)); + if (IP_HL(ip) == 5) + memcpy(&phu.ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t)); + else + phu.ph.dst = ip_finddst(ip); sp = &phu.pa[0]; return in_cksum((u_short *)tp, len, |