summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcedric <cedric@openbsd.org>2003-09-08 17:35:57 +0000
committercedric <cedric@openbsd.org>2003-09-08 17:35:57 +0000
commit179b31399718af04f7232c1875ab8ff4f5e80583 (patch)
treedad79fc65144d5e179de3042d1c0b373c4e1e801
parenttypo; ianm@cit.uws.edu.au (diff)
downloadwireguard-openbsd-179b31399718af04f7232c1875ab8ff4f5e80583.tar.xz
wireguard-openbsd-179b31399718af04f7232c1875ab8ff4f5e80583.zip
Fix 'tcpdump -v icmp' endianess buglet, print ID in hex.
Found by ho@, help/test pb@, hex suggestion/ok deraadt@
-rw-r--r--usr.sbin/tcpdump/print-icmp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/tcpdump/print-icmp.c b/usr.sbin/tcpdump/print-icmp.c
index c2dd324f02e..c11fcb5329e 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.14 2002/02/19 19:39:40 millert Exp $ */
+/* $OpenBSD: print-icmp.c,v 1.15 2003/09/08 17:35:57 cedric 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.14 2002/02/19 19:39:40 millert Exp $ (LBL)";
+ "@(#) $Header: /home/cvs/src/usr.sbin/tcpdump/print-icmp.c,v 1.15 2003/09/08 17:35:57 cedric Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -190,10 +190,11 @@ icmp_print(register const u_char *bp, register const u_char *bp2)
if (vflag) {
TCHECK(dp->icmp_seq);
(void)snprintf(buf, sizeof buf,
- "echo %s (id:%d seq:%d)",
+ "echo %s (id:%04x seq:%d)",
(dp->icmp_type == ICMP_ECHO)?
"request": "reply",
- dp->icmp_id, dp->icmp_seq);
+ ntohs(dp->icmp_id),
+ ntohs(dp->icmp_seq));
} else
str = tok2str(icmp2str, "type-#%d", dp->icmp_type);
break;