summaryrefslogtreecommitdiff
path: root/usr.sbin/tcpdump
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-08-10 19:54:19 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-08-10 19:54:19 +0000
commita085e62c11299e32db10ea2325f5aede69dd4d19 (patch)
treef833be76ee44a74ae7f31ee88ba3fb2f76831921 /usr.sbin/tcpdump
parent5c2ea455a84f3a65515ad5b936de82b18c35f985 (diff)
print the original ip packet on -vv; based on tcpdump.org; ok otto@
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r--usr.sbin/tcpdump/print-icmp.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-icmp.c b/usr.sbin/tcpdump/print-icmp.c
index c432765f116..de2d642c210 100644
--- a/usr.sbin/tcpdump/print-icmp.c
+++ b/usr.sbin/tcpdump/print-icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-icmp.c,v 1.15 2003/09/08 17:35:57 cedric Exp $ */
+/* $OpenBSD: print-icmp.c,v 1.16 2004/08/10 19:54:18 markus Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-icmp.c,v 1.15 2003/09/08 17:35:57 cedric Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-icmp.c,v 1.16 2004/08/10 19:54:18 markus Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -94,6 +94,13 @@ struct rtentry;
#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
#endif
+#define ICMP_INFOTYPE(type) \
+ ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+ (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+ (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
/* Most of the icmp types */
static struct tok icmp2str[] = {
{ ICMP_ECHOREPLY, "echo reply" },
@@ -368,6 +375,12 @@ icmp_print(register const u_char *bp, register const u_char *bp2)
break;
}
(void)printf("icmp: %s", str);
+ if (vflag > 1 && !ICMP_INFOTYPE(dp->icmp_type) &&
+ TTEST(dp->icmp_ip)) {
+ (void)printf(" for ");
+ oip = &dp->icmp_ip;
+ ip_print((u_char *)oip, ntohs(oip->ip_len));
+ }
return;
trunc:
fputs("[|icmp]", stdout);