diff options
author | 2001-09-02 12:01:35 +0000 | |
---|---|---|
committer | 2001-09-02 12:01:35 +0000 | |
commit | 65d90567efa300204abdf295c5f55f280e77c79a (patch) | |
tree | 5c733d283a93a061f69c1a32cfb98df281cd5980 | |
parent | regen (diff) | |
download | wireguard-openbsd-65d90567efa300204abdf295c5f55f280e77c79a.tar.xz wireguard-openbsd-65d90567efa300204abdf295c5f55f280e77c79a.zip |
add support for printing id and seq with icmp echo/echoreply; based on patch from cyxob@thief.dyndns.org
-rw-r--r-- | usr.sbin/tcpdump/print-icmp.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-icmp.c b/usr.sbin/tcpdump/print-icmp.c index c83b1ebe2d6..72c75e76af0 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.9 2001/06/10 22:17:08 mickey Exp $ */ +/* $OpenBSD: print-icmp.c,v 1.10 2001/09/02 12:01:35 jakob Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996 @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-icmp.c,v 1.9 2001/06/10 22:17:08 mickey Exp $ (LBL)"; + "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-icmp.c,v 1.10 2001/09/02 12:01:35 jakob Exp $ (LBL)"; #endif #include <sys/param.h> @@ -187,6 +187,22 @@ icmp_print(register const u_char *bp, register const u_char *bp2) TCHECK(dp->icmp_code); switch (dp->icmp_type) { + case ICMP_ECHOREPLY: + case ICMP_ECHO: + if (vflag) { + TCHECK(dp->icmp_seq); + (void)snprintf(buf, sizeof buf, + "echo %s (id:%d seq:%d)", + (dp->icmp_type == ICMP_ECHO)? + "request": "reply", + dp->icmp_id, dp->icmp_seq); + } else { + fmt = tok2str(icmp2str, "type-#%d", dp->icmp_type); + (void)snprintf(buf, sizeof buf, fmt, + ipaddr_string(&dp->icmp_ip.ip_dst)); + } + break; + case ICMP_UNREACH: TCHECK(dp->icmp_ip.ip_dst); switch (dp->icmp_code) { |