]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-icmp.c
From: Juergen Schoenwaelder <[email protected]>
[tcpdump] / print-icmp.c
index 5e50f3accd19ab82d59a27f5d402e481d239f456..5895ce983d383b267db0a43f5687541832a83c59 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.40 1999-10-30 05:11:13 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.43 1999-11-22 04:28:21 fenner Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
 #endif
 
 #include <sys/param.h>
@@ -162,7 +166,7 @@ struct id_rdiscovery {
 };
 
 void
-icmp_print(register const u_char *bp, register const u_char *bp2)
+icmp_print(register const u_char *bp, u_int plen, register const u_char *bp2)
 {
        register char *cp;
        register const struct icmp *dp;
@@ -349,6 +353,19 @@ icmp_print(register const u_char *bp, register const u_char *bp2)
                break;
        }
         (void)printf("icmp: %s", str);
+       if (vflag) {
+               if (TTEST2(*bp, plen)) {
+                       if (in_cksum((u_short*)dp, plen, 0))
+                               printf(" (wrong icmp csum)");
+               }
+       }
+       if (vflag > 1 && !ICMP_INFOTYPE(dp->icmp_type)) {
+               bp += 8;
+               (void)printf(" for ");
+               ip = (struct ip *)bp;
+               snaplen = snapend - bp;
+               ip_print(bp, ntohs(ip->ip_len));
+       }
        return;
 trunc:
        fputs("[|icmp]", stdout);