summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tcpdump/print-ether.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2010-01-14 04:57:06 +0000
committerjsing <jsing@openbsd.org>2010-01-14 04:57:06 +0000
commitaca7535d18d41876b7bf8dd4c30bb896e2184f1f (patch)
treef2d7bbcce2a2985d599145067b00e9f7240f2975 /usr.sbin/tcpdump/print-ether.c
parentPrint sense data during SCSIDEBUG again. Always print the decoded (diff)
downloadwireguard-openbsd-aca7535d18d41876b7bf8dd4c30bb896e2184f1f.tar.xz
wireguard-openbsd-aca7535d18d41876b7bf8dd4c30bb896e2184f1f.zip
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/print-ether.c')
-rw-r--r--usr.sbin/tcpdump/print-ether.c25
1 files changed, 19 insertions, 6 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');
}