]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp.c
better print the IP addresses native than using getname();
[tcpdump] / print-icmp.c
index ed3689f7471facc7005135c57d59400d3e733dab..fc17c263b27b107aab281c3eec36672aa0cb118f 100644 (file)
@@ -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)) {