From: mcr Date: Wed, 29 May 2002 03:09:48 +0000 (+0000) Subject: when reporting a bad checksum, indicate what it should have been. X-Git-Tag: tcpdump-3.8-bp~482 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/68ed33e9956a5398232b9ae4055aa365b10996a3 when reporting a bad checksum, indicate what it should have been. --- diff --git a/print-ip.c b/print-ip.c index c14d2fc2..b03fa512 100644 --- a/print-ip.c +++ b/print-ip.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.102 2001-11-16 02:17:36 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.103 2002-05-29 03:09:48 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -547,8 +547,9 @@ again: if ((u_char *)ip + hlen <= snapend) { sum = in_cksum((const u_short *)ip, hlen, 0); if (sum != 0) { - (void)printf("%sbad cksum %x!", sep, - ntohs(ip->ip_sum)); + (void)printf("%sbad cksum %x (->%x)!", sep, + ntohs(ip->ip_sum), + nthos(ip->ip_sum)-sum); sep = ", "; } }