]> The Tcpdump Group git mirrors - tcpdump/commitdiff
don't attempt checksumming in ICMP if the packet is a fragment
authorhannes <hannes>
Thu, 15 May 2003 16:58:03 +0000 (16:58 +0000)
committerhannes <hannes>
Thu, 15 May 2003 16:58:03 +0000 (16:58 +0000)
interface.h
print-icmp.c
print-ip.c

index a9c9d2ea5d5aa87b778ca4935f58757b68c10ab7..15b11fe65ac232c67d88d189b64dda4114e73eec 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.211 2003-05-11 06:01:16 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.212 2003-05-15 16:58:03 hannes Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -233,7 +233,7 @@ extern u_int ieee802_11_if_print(const struct pcap_pkthdr *, const u_char *);
 extern u_int ieee802_11_radio_if_print(const struct pcap_pkthdr *,
        const u_char *);
 extern void gre_print(const u_char *, u_int);
-extern void icmp_print(const u_char *, u_int, const u_char *);
+extern void icmp_print(const u_char *, u_int, const u_char *, int);
 extern void igmp_print(const u_char *, u_int);
 extern void igrp_print(const u_char *, u_int, const u_char *);
 extern void ip_print(const u_char *, u_int);
index df0970c80bf78c86effad19b5704893d1c9bd71b..848b0a3a6768529e4c143a17b0a9fb95e999eb82 100644 (file)
@@ -21,7 +21,7 @@
 
 #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)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.72 2003-05-15 16:58:04 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -260,7 +260,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 +476,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);
index 91d73a98142fbb4a0b341066f45adb34d0cc28f9..cb775f48614ebb34cbeb19f8f33155605edb5fb2 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.123 2003-05-15 15:25:18 hannes Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.124 2003-05-15 16:58:04 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -519,7 +519,8 @@ again:
                        break;
 
                case IPPROTO_ICMP:
-                       icmp_print(cp, len, (const u_char *)ip);
+                       /* pass on the MF bit plus the offset to detect fragments */
+                       icmp_print(cp, len, (const u_char *)ip, (off & 0x3fff));
                        break;
 
 #ifndef IPPROTO_IGRP