X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/111ff8a61dd320445f1d5167559cf65bfc2c26ca..addda66a53aa7be4ff798df2d86fda873f837270:/print-icmp.c?ds=inline diff --git a/print-icmp.c b/print-icmp.c index ed3689f7..fc17c263 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.65 2002-06-11 17:08:48 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.67 2002-07-21 21:03:07 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -483,11 +483,17 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2) str = tok2str(icmp2str, "type-#%d", dp->icmp_type); break; } - (void)printf("icmp: %s", str); + (void)printf("icmp %d: %s", plen, str); if (vflag) { + u_int16_t sum, icmp_sum; if (TTEST2(*bp, plen)) { - if (in_cksum((u_short*)dp, plen, 0)) - printf(" (wrong icmp csum)"); + sum = in_cksum((u_short*)dp, plen, 0); + if (sum != 0) { + icmp_sum = ntohs(dp->icmp_cksum); + (void)printf(" (wrong icmp cksum %x (->%x)!)", + icmp_sum, + in_cksum_shouldbe(icmp_sum, sum)); + } } } if (vflag > 1 && !ICMP_INFOTYPE(dp->icmp_type)) {