]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp.c
Cut off "snapend" at the length of the IPv4 or IPv6 payload, so we don't
[tcpdump] / print-icmp.c
index df0970c80bf78c86effad19b5704893d1c9bd71b..083276eb66e5ef70f59ea7d13c07f74a96339e0f 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.71 2002-12-11 07:14:01 guy Exp $ (LBL)";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.75 2003-11-16 09:36:22 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -39,6 +39,7 @@ static const char rcsid[] =
 
 #include "ip.h"
 #include "udp.h"
+#include "ipproto.h"
 
 /*
  * Interface Control Message Protocol Definitions.
@@ -260,7 +261,7 @@ struct id_rdiscovery {
 };
 
 void
-icmp_print(const u_char *bp, u_int plen, const u_char *bp2)
+icmp_print(const u_char *bp, u_int plen, const u_char *bp2, int fragmented)
 {
        char *cp;
        const struct icmp *dp;
@@ -476,7 +477,7 @@ icmp_print(const u_char *bp, u_int plen, const u_char *bp2)
                break;
        }
        (void)printf("icmp %d: %s", plen, str);
-       if (vflag) {
+       if (vflag && !fragmented) { /* don't attempt checksumming if this is a frag */
                u_int16_t sum, icmp_sum;
                if (TTEST2(*bp, plen)) {
                        sum = in_cksum((u_short*)dp, plen, 0);