diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2010-01-14 04:57:07 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2010-01-14 04:57:07 +0000 |
commit | b638b0d1c9483aa0d85b91bec3b99aa3177f0ad1 (patch) | |
tree | f208f94f1f25773dd723402a34c5f41ffd175851 /usr.sbin/tcpdump | |
parent | 4e62147eb84f6157eb23f0038558320e07b24cb8 (diff) |
Include the link-level header in the hex output if both the -x and -e
options are specified.
ok claudio@ sthen@ deraadt@ jmc@
Diffstat (limited to 'usr.sbin/tcpdump')
-rw-r--r-- | usr.sbin/tcpdump/print-ether.c | 25 | ||||
-rw-r--r-- | usr.sbin/tcpdump/tcpdump.8 | 18 |
2 files changed, 29 insertions, 14 deletions
diff --git a/usr.sbin/tcpdump/print-ether.c b/usr.sbin/tcpdump/print-ether.c index 2b6f87af220..7592ca053da 100644 --- a/usr.sbin/tcpdump/print-ether.c +++ b/usr.sbin/tcpdump/print-ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print-ether.c,v 1.26 2009/10/27 23:59:55 deraadt Exp $ */ +/* $OpenBSD: print-ether.c,v 1.27 2010/01/14 04:57:06 jsing Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -135,18 +135,31 @@ ether_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) printf("(LLC %s) ", etherproto_string(htons(extracted_ethertype))); } - if (!xflag && !qflag) - default_print(p, caplen); + if (!xflag && !qflag) { + if (eflag) + default_print(packetp, + snapend - packetp); + else + default_print(p, caplen); + } } } else if (ether_encap_print(ether_type, p, length, caplen) == 0) { /* ether_type not known, print raw packet */ if (!eflag) ether_print((u_char *)ep, length + sizeof(*ep)); - if (!xflag && !qflag) + if (!xflag && !qflag) { + if (eflag) + default_print(packetp, snapend - packetp); + else + default_print(p, caplen); + } + } + if (xflag) { + if (eflag) + default_print(packetp, snapend - packetp); + else default_print(p, caplen); } - if (xflag) - default_print(p, caplen); out: putchar('\n'); } diff --git a/usr.sbin/tcpdump/tcpdump.8 b/usr.sbin/tcpdump/tcpdump.8 index 041c0b7271f..4a1a156099b 100644 --- a/usr.sbin/tcpdump/tcpdump.8 +++ b/usr.sbin/tcpdump/tcpdump.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tcpdump.8,v 1.70 2010/01/03 13:24:09 schwarze Exp $ +.\" $OpenBSD: tcpdump.8,v 1.71 2010/01/14 04:57:06 jsing Exp $ .\" .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996 .\" The Regents of the University of California. All rights reserved. @@ -19,7 +19,7 @@ .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" -.Dd $Mdocdate: January 3 2010 $ +.Dd $Mdocdate: January 14 2010 $ .Dt TCPDUMP 8 .Os .Sh NAME @@ -260,16 +260,18 @@ Standard output is used if is .Ql - . .It Fl X -Print each packet -.Pq minus its link-level header -in hex and ASCII. +Print each packet in hex and ASCII. +If the +.Fl e +option is also specified, the link-level header will be included. The smaller of the entire packet or .Ar snaplen bytes will be printed. .It Fl x -Print each packet -.Pq minus its link-level header -in hex. +Print each packet in hex. +If the +.Fl e +option is also specified, the link-level header will be included. The smaller of the entire packet or .Ar snaplen bytes will be printed. |